Sleep Windows from Java

Hamza Yerlikaya picture Hamza Yerlikaya · Sep 2, 2009 · Viewed 7.2k times · Source

Is there command to use on windows from java to make the computer sleep?

Answer

Jherico picture Jherico · Sep 2, 2009

You can do it by executing a shell command, if you java app has enough rights to do so. The command is...

Runtime.getRuntime().exec("Rundll32.exe powrprof.dll,SetSuspendState Sleep");

That and other commands are shown here.