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

xiaoxiao2021-02-28  86

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(); } }
转载请注明原文地址: https://www.6miu.com/read-81843.html

最新回复(0)