Skip to main content

Communication between two Separate Java Program in the same Computer (Please Help Me)

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
3 replies [Last post]
navidnmc
Offline
Joined: 2012-09-19

Hello

Please help me :

I explain my problem under a example .

I have two separate java Program that run on the same
computer : Program -1 & Program-2 .

Explain Program-1 :

Name of Program -1 is

AttachmentSize
Program1__Program-2__Source_Code.zip45.49 KB

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jamesharte
Offline
Joined: 2012-09-28

To facilitate communication between processes, most operating systems support Inter Process Communication (IPC) resources, such as pipes and sockets. IPC is used not just for communication between processes on the same system, but processes on different systems.

Your requirement of not using a file to store information if the second program is not running would make for a little more challenge. You could identify if the connection is not available and if it is not save the value in a collection until the second program is up, but then you would handle the recognition of when the other program comes up. You would also need to determine when to do this check. Would it only be after each value is entered or would you have the first program looping waiting for the second program to appear. Of course, if the first program is stopped, the second program will not be able to get the values entered into the first program.

navidnmc
Offline
Joined: 2012-09-19

hi "jamesharte" .

I resolved the problem of my project, and I thank you that helped me .
I use Socket Connection between two Program and exchange my commands from this connection .

thanks

Ajay.Nayak
Offline
Joined: 2014-01-08

hi navidnmc
can you attach your latest code for communicating 2 java program ...