Runtime.getRuntime()。exec不返回

时间:2014-05-13 10:38:49

标签: java

LSPcalc是一个exe ...后跟一些参数。这个过程永远不会回来。


  Process procs =  Runtime.getRuntime().exec(new String[]{"./LSPcalc","U",SN,Penalty}); 

 System.out.println("Done initializing LSPcalc");

 StreamReaderThread stdout1 = new StreamReaderThread(procs.getInputStream(), "OUT");
 StreamReaderThread stderr1 = new StreamReaderThread(procs.getErrorStream(), "ERR");

  try{

     stdout1.start();
     stderr1.start();
     procs.waitFor();
     stdout1.join();
     stderr1.join();

 }catch(InterruptedException ie){
    ie.printStackTrace();
    }

0 个答案:

没有答案