Unable to Update Linux Date

I am trying to update the Linux System Date from my Java Program using the following command:

cmd = "date --set='+1 days'"

This doesnt work using the Runtime.getRuntime(cmd), but if I put the same command in a shell script and tell the runtime to execute that script it works fine.

Could someone tell me what the possible solution to the problem could be, coz I dont want to put the command into a seperate script.? and yea the reboot command works just fine if I do Runtime.getRuntime("reboot")

[523 byte] By [gengga] at [2007-10-1 8:44:38]
# 1
Are you sure the apostrophe is needed? Did you try to exec a String array?String cmd [] = { "date" , "--set=+1", "days'" };
BIJ001a at 2007-7-9 23:00:34 > top of Java-index,Administration Tools,Sun Connection...
# 2

Hey,

i did have the same problem and your solution works correct.

I have a thread who listen the serial port /dev/ttyS0 and do something.

In a specific case, i send a frame to my java program to change the linux date.

If the new date is bigger than actual date i have success. But when the date is minor then actual, my java program don磘 response anymore.

You have a sugestion?

i@na at 2007-7-9 23:00:34 > top of Java-index,Administration Tools,Sun Connection...