2024年4月19日发(作者:)

Java启动本机exe程序

转载自:/shtml/201411/25906_

Java启动(执行)本机应用程序EXE的三种方式

Java代码

// 第一种方式:利用cmd方式

/**

* 执行cmd命令

*

* @param command

* @throws IOException

*/

public static String executeCmd(String command) throws IOException {

("Execute command : " + command);

Runtime runtime = time();

Process process = ("cmd /c " + command);

BufferedReader br = new BufferedReader(new

InputStreamReader(utStream(), "UTF-8"));

String line = null;

StringBuilder build = new StringBuilder();

while ((line = ne()) != null) {

(line);

(line);

}

return ng();

}

executeCmd(start

"D:");

"AXAdWebBrowser"