Java Code to Restart Windows

Are you thinking how to restart Windows from Java. You can restart Windows operating system by executing a system command. You can restart windows by executing the system command shutdown /r /t 1. The following Java code will restart the windows computer when executed.

try {
    Runtime.getRuntime().exec("shutdown /r /t 1");
    } catch (IOException ex) {}

No comments:

Post a Comment