+ 1
How to shud down pc using java coading ?
2 Respuestas
+ 7
Linux, Mac OS
String sd = "shutdown -h now";
Windows
String sd = "shutdown.exe -s -t 0";
Runtime.getRuntime().exec(sd);
System.exit(0);
0
I'd go for Tashi N solution but I'd also like to point you at the Java Robot class that you may find inspirational in a similar context