Monday, May 24, 2010

How to shutdown windows using a java program??

I had an idea is to run the shutdown exe:


public class shutdown


{


public static void main(String[] args)


{


try


{


Runtime rt =Runtime.getRuntime();





String s = "C:\\WINDOWS\\system32\\shutdown.exe -s-t- 01";


Process p =rt.exec(s);


}


catch (Exception ex)


{


ex.printStackTrace();


}


}


}











but nothing happen I don't get an error but the computer don't shutdown please if somebody know how please help

How to shutdown windows using a java program??
Runtime.getRuntime().exec("cmd /c shutdown -r -f");
Reply:Java is for applets embedded in html





just push the reset on front of your computer or unplug it and plug it back in and pust start button on the front of your computer





I cant help u out much more than that


dont really know what u r doing in that ?
Reply:I think C++ might be a better language to do that


No comments:

Post a Comment