It's possible to run double JVM on one computer? Then how to do?
-
2please clarify the term 'double JVM'. – krock Jul 20 '10 at 00:29
-
2possible duplicate of [Running multiple JVMs](http://stackoverflow.com/questions/2030255/running-multiple-jvms) – Pascal Thivent Jul 20 '10 at 00:33
-
I mean multiple JVM. Thank you Pascal. – Zeck Jul 20 '10 at 00:53
-
3If one JVM is good, two must be awesome! – rpetrich Jul 20 '10 at 01:17
5 Answers
Running two JVM? Just run the java
twice, starting the same or different applications. What exactly you're trying to achieve?

- 1,490
- 14
- 22
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.

- 203,806
- 29
- 246
- 1,045
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

- 26,632
- 7
- 60
- 80
If you referring to JVM IMPLEMENTATION : Yes you can have multiple installations in your machine. Just install multiple JREs.
OR
Referring to JVM RUNTIME INSTANCE : Each application gets its own JVM instance. So just run 2 applications and you will get 2 JVM instances.
Eg : deploy two war files in tomcat. In this case there are 2 JVM instances in a single JRE.

- 10,309
- 6
- 39
- 55