r/javahelp • u/Berserker74 • May 27 '19
Communication between 2 separately running java applications.
Just as the title implies, how can I share around some data from one java program to another running at the same time? I am trying using sockets but I am only able to establish a connection between a program and a local server but not sure how to connect the 2nd application to it. Edit : thanks everyone! I was using sockets previously so I needed to looking a simple chat example like you you suggested and was able to make 2 java classes one which was the client and the other server which is exactly what I needed!
28
Upvotes
8
u/_harro_ May 27 '19
What's the use case?
Depending on what you want to achieve, the solution can/will be different, because there are multiple ways to do this.
- You can indeed use sockets
- you can use simple REST call's
- Common Database for both application
- Messaging mechanism (ActiveMQ for example).
- ...