Zeck
Zeck

Reputation: 6579

How to run double JVM on one computer

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

Upvotes: 0

Views: 1041

Answers (5)

rai.skumar
rai.skumar

Reputation: 10667

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.

Upvotes: 0

Paul Rubel
Paul Rubel

Reputation: 27222

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

Upvotes: 3

trashgod
trashgod

Reputation: 205775

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.

Upvotes: 3

yclian
yclian

Reputation: 1500

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

Upvotes: 3

groundhog
groundhog

Reputation: 4780

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

Upvotes: 3

Related Questions