File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Launch Multiple JVM From Within A Java Process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Launch Multiple JVM From Within A Java Process" Watch "Launch Multiple JVM From Within A Java Process" New topic
Author

Launch Multiple JVM From Within A Java Process

jason williams
Greenhorn

Joined: Nov 17, 2004
Posts: 14
I am testing my application, which consits of 1 master and 2 worker, with junit.

My question - What is the right way to pro programmatically launch another JVMs (on a single machine ) to simulate several servers running simultaneously?

Most of webpage I searched on the internet tells using Runtime.exec(). Is it recommended using this method? Or any other suggestion?

I appreciate any commentary.

Many thanks.
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
Here's required reading when using Runtime.exec(). I see that it's 10 years and one day old today :-)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19675
    
  18

And still very relevant.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38467
    
  23
It's a little easier if you use the ProcessBuilder class, but otherwise Daconta's comments still apply unchanged.
 
jQuery in Action, 2nd edition
 
subject: Launch Multiple JVM From Within A Java Process