Search This Blog

Showing posts with label restart. Show all posts
Showing posts with label restart. Show all posts

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) {}