Campbell Ritchie wrote:They require the date in month‑day‑year format. That is the problem (I think). When it says "07/04/16...", it is ambiguous; is that 7th April or 4th July?
Campbell Ritchie wrote:
Please copy'n'paste the exact command which works. You may be passing date and time as separate arguments. Also have a look at the man pages for pmset and see how many different arguments you can pass.Marek Curda wrote:. . . When I use the exact same command in terminal it works... But I tried it just to be sure and it gives me same error...
Knute Snortum wrote:Could it be that the command wants a date in DD/MM/YY format?
Knute Snortum wrote:
Cannot run program "/usr/bin/sudo "
You have a space inside the quotes. Remove it and it should run. (And remove the other spaces at the end of commands too.)
Campbell Ritchie wrote:Welcome to the Ranch
Question too hard for this forum: will be moved elsewhere.
If you need sudo at the terminal, you will doubtless need to include sudo in the commands array. I would suggest you pass that array to Arrays.toString(cmd) and print it out, which will allow you to see whether the format is the same as you are passing to the terminal.
Also, you didn't say whether you are using Runtime#exec to run your program, or something else.