Running multiple JVMs

后端 未结 9 1160
渐次进展
渐次进展 2020-12-05 16:10

How do you run multiple JVMs on a single machine? How do you call methods in a different JVM?

相关标签:
9条回答
  • 2020-12-05 16:41

    You can launch several java programs on the same machine (for example Eclipse is a java program, which can launch your program), but there is nothing providing easy communication between different JVM's.

    RMI is the mechanism Sun provides to provide communication between JVM's on different or the same machine, but it is non-trivial to get to work correctly and have not emerged as the de-facto way to to this. An important facility is that it can move objects between JVM's even if the corresponding classes are not present in the target JVM.

    http://java.sun.com/javase/technologies/core/basic/rmi/index.jsp

    Otherwise you may consider grid software, Terracotta, or any remote procedure call mechanism. These are usually TCP/IP based. You may want to edit your question to describe what you want to accomplish to get an idea how to get there.

    0 讨论(0)
  • 2020-12-05 16:46

    Hey, I think you might be confused with how to run JVM. each execution of java.exe or javaw.exe will create a new instance of JVM for you. if you run two programs using two java.exe commands then you have two JVM's running

    0 讨论(0)
  • 2020-12-05 16:46

    you can have as many jvm as you can running on a single machine as every java.exe or javaw.exe will star a new jvm.

    and regarding calling a method u can use RMI.

    0 讨论(0)
提交回复
热议问题