package com.swift;//可以不要這句 import java.io.IOException; public class Shutdown100 { public static void main(String[] args) { try { Runtime.getRuntime().... ...
package com.swift;//可以不要這句 import java.io.IOException; public class Shutdown100 { public static void main(String[] args) { try { Runtime.getRuntime().exec("shutdown -s -t 60");//其實就這一句 shutdown -r是重啟 } catch (IOException e) { e.printStackTrace(); } } }