| | |

Shutdown your system using Java program

This is a Simple Java program for shutdown your computer .

here in this program I’m executing a system command for shutdown ( shutdown –s –t) though

runtime .

make sure that before you run this program :

// save all the open programs and files before you run this program

import java.io.*;
class Shutdown{
public static void main(String arg[]){
Runtime runtime = Runtime.getRuntime();
try{
Process proc = runtime.exec(“shutdown -s -t 0”);
System.exit(0);
}
catch(Exception e)
{
System.out.println(“e”);
}
}
}

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *