Runtime的操作一个记事本的例子

import java.io.IOException;


public class RuntimeDemo3 {


public static void main(String[] args) throws IOException, InterruptedException {

Runtime runtime = Runtime.getRuntime();
//执行一个运行程序实现对记事本运行的操作
Process exec = runtime.exec("notepad.exe");
//执行记事本存活5秒
Thread.sleep(5000);
//对进程的关闭
exec.destroy();

}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章