Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to have InterProcess communication in Java?

Tags:

jvm

ipc

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 ?

like image 952
Geek Avatar asked May 13 '26 14:05

Geek


2 Answers

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.

like image 189
John Millikin Avatar answered May 16 '26 21:05

John Millikin


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.

like image 43
Peter D Avatar answered May 16 '26 22:05

Peter D