java里调用windows程序代码,比如 notepad 记事本 等
- import java.io.IOException;
- public class Open {
- public static void open(String fileName) throws IOException
- {
- Runtime r = Runtime.getRuntime();
- Process p = null;
- try
- {
- p = Runtime.getRuntime().exec("cmd /c start "+fileName);
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- }
这篇博客介绍了如何使用Java代码来调用Windows系统中的应用程序,例如记事本。通过`Runtime.getRuntime().exec()`方法结合命令行指令实现进程启动。

1155

被折叠的 条评论
为什么被折叠?



