wood burning stoves 2.0*
The moose likes Java in General and the fly likes separate JVM's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "separate JVM Watch "separate JVM New topic
Author

separate JVM's

tony james
Greenhorn

Joined: Jul 24, 2001
Posts: 12
Hi,
coud you tell me of some mechanism by which i start as many separate JVM's from one program/system? i do not want to use threads because they belong to a single JVM.
Thanx in advance.
tony
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Here's one way:

------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
tony james
Greenhorn

Joined: Jul 24, 2001
Posts: 12
Hi Michael,
When i compile the above code, i get this error:
Method exec(java.lang.String) not found in class java.lang.System.
i cant find System.exec() in the java API...
Please help.
Thanx,
tony

[This message has been edited by tony james (edited December 07, 2001).]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Try using
Runtime.getRuntime().exec("java test");
Runtime.getRuntime().exec("notepad.exe myfile.txt");
Runtime.getRuntime().exec("c:\\Program Files\\Internet Explorer\\IExplore.exe");
Runtime.getRuntime().exec("jar -tf whatever.jar > output.txt");
Runtime.getRuntime().exec("cmd /K start run.bat");
etc.

etc

"JavaRanch, where the deer and the Certified play" - David O'Meara
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Serves me right for typing off the top of my head -- thanks Cindy.
tony james
Greenhorn

Joined: Jul 24, 2001
Posts: 12
Hi Cindy,
Thanq so much.It works fine.
Can u explain this statement ... the argument passed to exec() .
Runtime.getRuntime().exec("cmd /K start run.bat");
Are there any other parameters for running a batch file?
Thanx
tony
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: separate JVM's
 
Similar Threads
When JVM will be started?
JVM's maximum number of Threads?
Multi Process Configuration
invoking jvm from other jvm
Regarding running multiple instances of an application