Jack
Jack

Reputation: 31

pausing a batch file while waiting for java to finish

I need to run a two java programs from a batch script. I need to wait for the first java program to finish running before the second one starts. Is there a way to do this? I'm on a windows machine and I can't edit the java programs so I'm using a batch script to launch them.

So it would be something like this

cd %PARSEDIR%
set CLASSPATH=.\lib\jpcap-0.01.16.jar
set CLASSPATH=%CLASSPATH%;.\lib\jpcap.jar
START /WAIT java -Xms768m -Xmx768m -classpath %CLASSPATH% parser.test.firstStage %2
timeout 5
START /WAIT java -Xms768m -Xmx768m -classpath %CLASSPATH% parser.test.lastStage %2

I need the first program to finish before the the batch script moves on. How do I accomplish this?

Thanks!

edit: added what the code currently looks like

Upvotes: 3

Views: 1982

Answers (1)

Shmil The Cat
Shmil The Cat

Reputation: 4670

Use the start /WAIT command (http://ss64.com/nt/start.html)

Upvotes: 3

Related Questions