javawindowssleepstandby

Sleep Windows from Java


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


Solution

  • 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.