java - Running a multiple jar files in a batch file - Stack Overflow

I'm trying to run a batch file that included multiple jar files, Batch file includes 3 Jar files w

I'm trying to run a batch file that included multiple jar files, Batch file includes 3 Jar files which executes one after another in one window, My batch file is working correctly for one record which fetches data from excel sheet.

Consider a scenario in which i have 5 records and i wanted to run the batch file in the manner like for 1st record->1st jar prog executes then 1st record->2nd jar file and finally 1st record->3rd jar file executes. Then this loop continues for the second record and likewise. Could anyone please help me to modify the below script which runs in loop and i want to save a executed results in a separate text file.

My script is below:

REM Run first and finish ... java -jar first.jar

REM .. then start number two. java -jar second.jar

REM .. then start number three. java -jar third.jar

Kindly help!

I'm trying to run a batch file that included multiple jar files, Batch file includes 3 Jar files which executes one after another in one window, My batch file is working correctly for one record which fetches data from excel sheet.

Consider a scenario in which i have 5 records and i wanted to run the batch file in the manner like for 1st record->1st jar prog executes then 1st record->2nd jar file and finally 1st record->3rd jar file executes. Then this loop continues for the second record and likewise. Could anyone please help me to modify the below script which runs in loop and i want to save a executed results in a separate text file.

My script is below:

REM Run first and finish ... java -jar first.jar

REM .. then start number two. java -jar second.jar

REM .. then start number three. java -jar third.jar

Kindly help!

Share Improve this question asked Mar 18, 2014 at 3:20 LivynwaLivynwa 11 silver badge1 bronze badge
Add a ment  | 

3 Answers 3

Reset to default 3

You cloud do something like this that waits until the execution of one jarfile is done.

@echo off
java -jar 1.jar
pause
java -jar 2.jar
pause

If you want to run the jars sequentially, you can write a .bat file containing the following;

@echo off
java -jar first.jar
java -jar second.jar
java -jar third.jar

If you want to tun the jars simultaneously, you can write the .bat file as follows;

@echo off
start java -jar first.jar
start java -jar second.jar
start java -jar third.jar

START mand will start running the jar in a new window.

You'll need something like

FOR %%A in (1 2 3 4 5) DO (
java -jar first.jar
java -jar second.jar
java -jar third.jar
)

That should execute the three jar consecutively five times. I didn't actually test this, but it should give you the idea. Here is an article on FOR loops syntax in batch files: http://www.robvanderwoude./for.php

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744890150a4599362.html

相关推荐

  • java - Running a multiple jar files in a batch file - Stack Overflow

    I'm trying to run a batch file that included multiple jar files, Batch file includes 3 Jar files w

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信