控制本机进程

public class RunTimeDemo02 {
    public static void main(String[] args) {
        Runtime runtime = Runtime.getRuntime();
        Process process = null;
        try {
            process = runtime.exec("notepad.exe");
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            Thread.sleep(5000);
        } catch (Exception e) {
            e.printStackTrace();
        }
        process.destroy();
    }
}

posted @ 2014-08-12 12:01  塔斯曼  阅读(130)  评论(0编辑  收藏  举报