Shutting down a computer

Create your own function to execute an OS command through the command line?

For the sake of an example. But know where and why you’d want to use this as others note.

public static void main(String arg[]) throws IOException{
    Runtime runtime = Runtime.getRuntime();
    Process proc = runtime.exec("shutdown -s -t 0");
    System.exit(0);
}

Leave a Comment