一个小问题,怎么在java中运行另一个应用程序?收到答案立即结贴 //windows onlyProcess p = Runtime.getRuntime().exec("cmd.exe /c d:\aa.exe");p.waitFor(); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //windows onlyProcess p = Runtime.getRuntime().exec("cmd.exe /c D:\\aa.exe");p.waitFor(); import java.io.*;public class ExecFunction() { public static void main(String[] arg) { Runtime rt = Runtime.getRuntime(); try { String cmd = "C:\\WINNT\\NOTEPAD.EXE";//这里是你的要运行的程序命令 Process proc = rt.exec(cmd); BufferedInputStream errs = new BufferedInputStream(proc.getErrorStream()); proc.waitFor(); errs.close(); } catch(Exception e) { e.printStackTrace(); } }} 对于一个java的菜鸟来说 今天高兴,出来露露脸... 这段js代码的含义 请教:JAVA中JTable中自适应或自定义宽度和与,以及数据库导操作的几个疑问 JLabel文本如何竖立显示(swing界面)高手在哪里? Comparator排序 欢迎加入豆瓣swing小组 HSSFWorkbook初始化失败 紧急求救,关于weblogic过滤器的小问题,谢谢!奖励500分 模板问题 谢谢 为什么会编译失败?一个异常的问题 apache-tomcat 4.0 运行 html 页的问题,急
Process p = Runtime.getRuntime().exec("cmd.exe /c D:\\aa.exe");
p.waitFor();
public static void main(String[] arg) {
Runtime rt = Runtime.getRuntime();
try {
String cmd = "C:\\WINNT\\NOTEPAD.EXE";//这里是你的要运行的程序命令
Process proc = rt.exec(cmd);
BufferedInputStream errs = new BufferedInputStream(proc.getErrorStream());
proc.waitFor();
errs.close();
} catch(Exception e) {
e.printStackTrace();
}
}
}