Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to launch two JVM executing two java programs

 
Arun Gupta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to launch two different JVM, each one is executing a java program. Can any one suggest me how to do this
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You just run "java" twice, with the appropriate arguments.

Or do you mean that you want two JVMs in the same process? If so, that's probably possible, but you would need to launch the JVMs using your own native code and the Java Invocation Interface.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The number of java processes you create is the number of JVM's running at that point of time.

Say I run a time consuming program from console like

java MySampleProgram

then I open my eclipse and then I start my tomcat instance.So at this point of time I have three jvm's running.one for each of the processes.

So if I investivage the current process running then I would find that there are two instances of java and one of javaw (used by eclipse).
 
Paul Clapham
Sheriff
Pie
Posts: 20771
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am guessing that Arun wants to run two different versions of Java (e.g. Java 1.4.2 and Java 5). This would be done by setting the PATH variable suitably, or by hard-coding the path to the java.exe file.
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Arun,

Can you give more inputs regarding your requirement?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic