tags:

views:

1360

answers:

3

I have two Java Programs each running in its own JVM instance ? Can they communicate with each other using any IPC technique like Shared Memory or Pipes ? Is there a way to do it ?

+2  A: 

Yes; D-BUS and Pipes are both easy to use, and cross-platform. D-BUS is useful for general message-passing IPC, and pipes for sending bulk data.

You can also open a TCP or UDP socket on localhost, if you need to support multiple clients connecting to a central server.

I also found an implementation of UNIX sockets in Java, though it requires the JNI.

John Millikin
A: 

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

Java Remote Method Invocation (Java RMI) enables the programmer to create distributed Java technology-based to Java technology-based applications, in which the methods of remote Java objects can be invoked from other Java virtual machines*, possibly on different hosts. RMI uses object serialization to marshal and unmarshal parameters and does not truncate types, supporting true object-oriented polymorphism.

Peter D
A: 

Sure. Have a look at RMI or a Shared Memory concept like Java Spaces.

Mork0075