File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

separate JVM's

 
tony james
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7292
Netbeans IDE VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's one way:

------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
tony james
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Serves me right for typing off the top of my head -- thanks Cindy.
 
tony james
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic