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();

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