+ 1

How to shud down pc using java coading ?

19th Feb 2017, 6:39 PM
Pratyush Jajodia
Pratyush Jajodia - avatar
2 Answers
+ 7
Linux, Mac OS String sd = "shutdown -h now"; Windows String sd = "shutdown.exe -s -t 0"; Runtime.getRuntime().exec(sd); System.exit(0);
19th Feb 2017, 6:50 PM
Tashi N
Tashi N - avatar
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
20th Feb 2017, 7:56 AM
seamiki
seamiki - avatar