Process proc = Runtime.getRuntime().exec("***.exe"); 
proc.waitFor();//等待proc终止
//其他处理程序

解决方案 »

  1.   

    proc.waitFor();后还是没有等待。
      

  2.   

    //确实等待了,你运行看看
    //-------------------------------
    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)
    {}
    }
    }
      

  3.   

    这样应该可以的!!!! 
        
    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("哈哈,没错吧!");
      

  4.   

    我使用“notepad”试过了,可以在***.exe关闭(或执行完成后)再运行其他处理程序。
    但是使用我的那个exe文件就有问题,没有等***.exe关闭就运行其他程序了。
      

  5.   

    大家不要用notepad,可以用ping或qq的执行文件试试,waitfor()有问题
      

  6.   

    手误,就是proc.waitFor();它起不起作用可能跟exe文件有关。