In my Java program I need to call two DOS batch programs namely call.bat and start.bat. First I need to start the batch program call.bat and once that program is completed, I need to call the other batch file start.bat.
The piece of code which I am using is:
public static void ExecuteScripts( ){
try {
\\Start the first batch program call.bat
Process p = Runtime.getRunt ime().exec("cmd /c start .\\scripts\\cal l.bat");
p.waitFor();
System.out.prin tln("Exit value "+p.exitValue() );
\\Start the second batch program run.bat
Process p1 = Runtime.getRunt ime().exec("cmd /c start .\\scripts\\run .bat");
}
catch (Exception e) {
e.printStackTra ce();
}
For this piece of code it starts the first batch program(i.e, call.bat) in a command prompt and immediately it starts the second batch program (i.e, run.bat) in another command prompt. So it runs both the batch programs simultanesously . But what I wanted is that my program should wait till the first batch is executed and then start the second batch.
Please tell me how to wait between these two runtime commands in JAVA
With regards,
C.Chenthil.
-------------------
The piece of code which I am using is:
public static void ExecuteScripts( ){
try {
\\Start the first batch program call.bat
Process p = Runtime.getRunt ime().exec("cmd /c start .\\scripts\\cal l.bat");
p.waitFor();
System.out.prin tln("Exit value "+p.exitValue() );
\\Start the second batch program run.bat
Process p1 = Runtime.getRunt ime().exec("cmd /c start .\\scripts\\run .bat");
}
catch (Exception e) {
e.printStackTra ce();
}
For this piece of code it starts the first batch program(i.e, call.bat) in a command prompt and immediately it starts the second batch program (i.e, run.bat) in another command prompt. So it runs both the batch programs simultanesously . But what I wanted is that my program should wait till the first batch is executed and then start the second batch.
Please tell me how to wait between these two runtime commands in JAVA
With regards,
C.Chenthil.
-------------------
Comment