Skip to main content

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

Please note these forums are being decommissioned and use the new and improved forums at
3 replies [Last post]
Joined: 2012-09-19


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 “InputFrame” that is a simple frame that contain a
JTextField and a Button and a JTextArea .

Explain Program 2 :

Name of Program-2 is “OutputFrame” that is a simple frame that contain
a simple JTextArea that this JTextArea is a Instance object
from a class with name of “DisplayFrame” .

This instance object from class of “DisplayFrame” added to
frame of “OutputFrame” .

Explain My Problem :

Now I want run both Program 1 & 2 simultaneously in the same computer
and when I enter a text in JTextField in Program-1 and after click on
the Button “OK” that Text Entered in this JTextField In addition to
JTextArea in Program-1 display In JTextArea in Program-2 .

Note :

I do not want use a share file between two Program-1 and -2 Or DataBase .

Note :

I want if Program-1 run but Program-2 is not running and i enter a text in JTextFeild in Program-1 , after running Program-2 that Entered Text Displaye in JTextArea in Frame of Program-2 .(Offline Message) .

Both Source code of Program-1 and Program-2 is Attached .


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.
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.

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 .


Joined: 2014-01-08

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