0

I want to run a java program SampleProgram.java 10 times with different parameters. I checked running the java program from .bat file. My question is that is it possible to run the same program SampleProgrammultiple times like the following :

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?

4
  • Of course it would. Also, why can't you just try this out yourself? Commented Jun 13, 2016 at 17:52
  • I was doing a basic research on if this is possible. And I didn't find much useful links. So I thought of asking the question. Commented Jun 13, 2016 at 18:43
  • Ok, but whats stopping you just running it yourself and finding out? It takes longer to type out your question than it does to try it yourself Commented Jun 13, 2016 at 18:45
  • Yeah. I could have. Commented Jun 13, 2016 at 18:46

1 Answer 1

2

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. 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.