在线等: Runtime.getRuntime().exec()的问题 Process proc = Runtime.getRuntime().exec("***.exe"); proc.waitFor();//等待proc终止//其他处理程序 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 proc.waitFor();后还是没有等待。 //确实等待了,你运行看看//-------------------------------public class Execute{ public static void main(String[] args) throws java.io.IOException { Runtime r=Runtime.getRuntime(); Process p=r.exec("NotePad.exe"); try { p.waitFor(); System.out.println("exit code="+p.exitValue()); } catch(InterruptedException e) {} }} 这样应该可以的!!!! Runtime run=Runtime.getRuntime();System.out.println("启动Notepad");Process proc=run.exec("NotePad");proc.waitFor();System.out.println("等待,马上打开另一个文件");run.exec("NotePad d:\\Limit.txt");System.out.println("哈哈,没错吧!"); 我使用“notepad”试过了,可以在***.exe关闭(或执行完成后)再运行其他处理程序。但是使用我的那个exe文件就有问题,没有等***.exe关闭就运行其他程序了。 大家不要用notepad,可以用ping或qq的执行文件试试,waitfor()有问题 手误,就是proc.waitFor();它起不起作用可能跟exe文件有关。 如何判断list里面内容。 开源两个小程序。 怎么处理这样的式子,给个思路就行。 请教:关于字符串unicode显示问题,谢谢 = =!编程还是出点错。帮忙修改下 java调用DLL文件 Java函数小问题 为什么一打开页面就出现验证码错误,感谢 请教,想问问在构造函数是如申明为private跟public有什么区别呢? 在JAVA中,怎么将用户绘制的图形用XML解释 关于BDK的问题,帮帮忙,谢谢!!!!!!! 一段列表筐代码不知道能不能短一些(请高手帮忙)
//-------------------------------
public class Execute
{
public static void main(String[] args)
throws java.io.IOException
{
Runtime r=Runtime.getRuntime();
Process p=r.exec("NotePad.exe");
try
{
p.waitFor();
System.out.println("exit code="+p.exitValue());
}
catch(InterruptedException e)
{}
}
}
Runtime run=Runtime.getRuntime();
System.out.println("启动Notepad");
Process proc=run.exec("NotePad");
proc.waitFor();
System.out.println("等待,马上打开另一个文件");
run.exec("NotePad d:\\Limit.txt");
System.out.println("哈哈,没错吧!");
但是使用我的那个exe文件就有问题,没有等***.exe关闭就运行其他程序了。