aspose 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
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: 19723
    
  20

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: 39436
    
  28
It's a little easier if you use the ProcessBuilder class, but otherwise Daconta's comments still apply unchanged.
 
Don't get me started about those stupid light bulbs.
 
subject: Launch Multiple JVM From Within A Java Process