28

In bash:

java -jar jarfile1.jar &
java -jar jarfile2.jar &

The ampersand lets you launch the first program, and then do another one while the first is still running.

How do I do this in cmd? (XP if it's relevant).

JdeBP
  • 27,556
  • 1
  • 77
  • 106
Cam Jackson
  • 2,586

3 Answers3

35

start with the /B option

Start application without creating a new window. The application has ^C handling ignored. Unless the application enables ^C processing, ^Break is the only way to interrupt the application

start /B java -jar jarfile1.jar

start /B java -jar jarfile2.jar
Nifle
  • 34,998
5

I like the answer from Nifle better but can't you just spawn a secondary cmd shell? You can do this ad nauseam.

cmd /c cmd /c cmd /c cmd /k echo Hello World!

For a number of reasons, his answer is better, specifically if you want to wait until one process is done (like MSI installation, not so relevant to your case). So, stick with start.

songei2f
  • 389
0

This is not an answer, but for some applications it's very very relevant. If you use start /B, notice that when the shell terminates, the background processes also terminate. This however is not the case in bash