title: Waiting for finished Java-process
body: <p>I have a java application (principal) that calls an executable jar:</p>
  
  <pre><code>Process p = Runtime.getRuntime().exec(java -jar C:\\PFC\\maestro.jar)
  p.waitFor();
  </code></pre>
  
  <p>maestro.jar is a Java application that creates 2 threads, and calls another executable jar (which Process variable is "b"). Then I wait for them like this:</p>
  
  <pre><code>    b.destroy();  //kill other executable jar that is called
      manejadora.join();  //thread finished
      controlador.join();  //thread finished
      System.out.println("all finished");
  </code></pre>
  
  <p>maestro.jar runs CORRECTLY and it shows "terminated" on eclipse when I run it, so there are no problems.</p>
  
  <p>When principal tries to run maestro.jar it runs correctly, but principal keeps waiting for maestro.jar on "p.waitFor()" when maestro.jar has already finished.</p>
  
  <p>I don't understand why.</p>
  
  <p>Could you give me some orientation about this? Thanks so much!</p>