title: How make a java program wait until a batch file that is executed with a java process is terminated
body: <p>i am executing a sequence of batch files, i just need my java program to wait for the first batch file to exit and then execute the next. what happens is every thing got executed without the exit of the file that has been executed before it.</p>
  
  <p>This is my code, i am running it in a loop</p>
  
  <pre><code>String cmd = "cmd /c start /min file1.bat"; 
  
  Process pr = Runtime.getRuntime().exec(cmd);
  
  pr.waitFor();
  </code></pre>