Java控制电脑关机

package com.zeph.android.shutdown;

import java.io.IOException;

public class ShutDownPC {
	public void shutdown() {
		try {
			Runtime.getRuntime().exec("shutdown -s -f -t 10");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		ShutDownPC pc = new ShutDownPC();
		pc.shutdown();
	}
}

你可能感兴趣的:(J2SE)