How do you run multiple JVMs on a single machine? How do you call methods in a different JVM?
Yes you can run multiple VMs on the same machine. You just need to specify which one to run.
When you say you want to call methods running on different JVMs do you mean have them talk to each other? If so look at Remote Method Invocation (RMI).
There are several insightful answers here, but something that interests me the driving requirement for running multiple JVMs. Why do you believe you need to do this? If you are looking for parallel processing, you might want to consider a multi-threaded application as opposed to running multiple JVMs. Since each JVM could very likely require significant resources and you'd like to have communication between paths of execution, this may very likely be a better solution for your needs.
How do you run multiple JVMs on a single machine?
Just launch multiple java
processes.
How do you call methods in a different JVM?
Use any type of RPC framework (RMI, EJB, web service, etc.).
It sounds like your talking about having different methods within a single application run under different JVMs. This is not possible.
If you want to use different JVMs for different applications, you'll have to manually specify the path to the particular JRE when you start an app. Example:
$PATH_TO_FIRST_JVM/bin/java -jar application1.jar
$PATH_TO_DIFFERNT_JVM/bin/java -jar application2.jar
How do you run multiple JVMs on a single machine? How do you call methods in a different JVM?
RMI is how this is generally done. I also want to do the same thing but with out RMI. Easy way to get past the 1.5g ceiling on 32bit JVM's which on windows are the only ones that can play video (JMF + Fobs, VLCJ, GStreamer all fail with Oracles 64bit JVM, Harmony isnt ready yet, gave it a shot, wasn't pretty). Figured the video could run in another JVM and somehow share the objects probably via some JNI.
This doens't make any sense.
It's easy to install different JVMs, just install the various JREs, JDKs, etc.
To execute the different one, you would use the proper java command from each install. Many projects rely on JAVA_HOME for this setting.
If you're talking about multiple JVMs in a browser for applets, I can't help you.