tags:

views:

120

answers:

4

It's possible to run double JVM on one computer? Then how to do?

+2  A: 

A JVM is simply a process. You just start the JVM.

groundhog
+2  A: 

Running two JVM? Just run the java twice, starting the same or different applications. What exactly you're trying to achieve?

yclian
+3  A: 

Here's a simple example:

$ java -jar SwingSet2/SwingSet2.jar ; java -jar Java2D/Java2D.jar

Addendum: Here are two more complex examples: a command line program to start/stop a GUI program in a separate JVM; a Swing program to start/stop a different Swing program in a separate JVM.

trashgod
+3  A: 

If what you're looking for is being able to run two different versions of the JVM, say you have an app that's been tested with a given version, say 1.4.y, but you want to experiment with a newer version, say 1.6.21, you need to set your JAVA_HOME environment variable. This tells your system where to look for java.

In linux/bash it's as easy as adding the following to your bashrc, or the shell script that runs your app:

JAVA_HOME=/path/to/toplevel-jvm-dir

Here's a link for windows Setting JAVA_HOME via GUIs and batch:

set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_07
Paul Rubel