How to communicate in Two JVM
In one client, from the main windows, open two sub-windows.
When open the two sub-windows, I want use different JVM. But I does not know how to communicate in two JVM each other.
In one client, from the main windows, open two sub-windows.
When open the two sub-windows, I want use different JVM. But I does not know how to communicate in two JVM each other.
Why would you want to run two VMs on a client?
Regardless you can either use sockets or files to communicate. You can wrap the socket communication in some other protocol such as RMI if you wish.
Using sockets can be anyoing if a simplistic firewall is in place.
> Using sockets can be anyoing if a simplistic firewall
> is in place.
Using sockets can be annoying if there is no TCP/IP stack as well.
But of course that one means you can't use sockets at all, whereas the your suggestion just means that one has to understand the target platform.
Using JNI might help you out. Pls elaborate the question so that I can assist you in defining a method to do so.
> Using JNI might help you out.
How?
Certainly you can do sockets in C but then java already does that.
Via pipes? Or shared memory? Why are those better, particularly with JNI than sockets?
I mean, While Java program running on default JVM, you can create another JVM using JNI and then call functions specifying the JVM on which that function has to be executed. I haven't tried creating JVM using JNI call, but there is a function to do so.
> I mean, While Java program running on default JVM,
> you can create another JVM using JNI
Not with the Sun VM you can't.It will not create another VM.
> and then call
> functions specifying the JVM on which that function
> has to be executed. I haven't tried creating JVM
> using JNI call, but there is a function to do so.
And it will fail if a VM already exists in the same application.