[英]How to run the same java program with different command line arguments from a file
I want to run a java program SampleProgram.java
10 times with different parameters. 我想用不同的参数运行Java程序
SampleProgram.java
10次。 I checked running the java program from .bat file. 我检查了从.bat文件运行Java程序的情况。 My question is that is it possible to run the same program
SampleProgram
multiple times like the following : 我的问题是是否可以多次运行相同的程序
SampleProgram
,如下所示:
java -jar SampleProgram.jar argument1 argument2
java -jar SampleProgram.jar argument3 argument4
java -jar SampleProgram.jar argument5 argument6
Will writing the above lines in a batch file, testRun.bat and running runTest.bat run the java programs with different arguments? 将上述行写入批处理文件testRun.bat中并运行runTest.bat可以使用不同的参数运行Java程序吗?
You probably need to launch them with start /B
to launch them in background otherwise your batch will launch them sequentially instead of launching them in parallel. 您可能需要使用
start /B
启动它们以在后台启动它们,否则您的批处理将按顺序启动它们,而不是并行启动它们。 So try this: 所以试试这个:
start /B java -jar SampleProgram.jar argument1 argument2
start /B java -jar SampleProgram.jar argument3 argument4
start /B java -jar SampleProgram.jar argument5 argument6
As it is done in this answer . 就像在这个答案中所做的那样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.