Runtime.getRunTime().exec()
好像是不阻塞调用,它另外开一新线程,可能是你第一个进程没有做完,就掉了第二个,你在其中做个足够大的等待,或者得到process,通过process得到输出流,根据输出流判断是否应该
执行第二个进程

解决方案 »

  1.   

    import java.io.*;
    import java.lang.*;
    public class test
     {
      public static void main(String[] args) throws IOException
       {
        Process p1=Runtime.getRuntime().exec("d:\\oracle\\ora81\\bin\\exp.exe test/test@test file=test.dmp");
        p1.waitfor();
        Runtime.getRuntime().exec("ftp -s:ftp.txt 192.168.1.1");
       }
     }
    ok!!!!!!!!!!!!!
      

  2.   

    to : tangjiyu(小雨) 
      你好!你的代码编译后执行,什么结果也没有啊。
      

  3.   

    我是这样做的,行呀。
    什么结果也没有啊。-----是不是Process p1=Runtime.getRuntime().exec("d:\\oracle\\ora81\\bin\\exp.exe test/test@test file=test.dmp");没有产生任何结果
    p1.waitFor()的意思是等p1执行完毕在执行下面的语句。
      

  4.   

    我在执行这个程序的时候,它就什么反应也没有,然后我把程序中断了,
    test.dmp就开始生成了。
    不知为什么?
      

  5.   

    是等的啊,可是没有执行啊,CTRL-C中断程序后才执行的