1 Attachment(s)
Communication between two Separate Java Program in the same Computer (Please Help Me)
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 “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 .
Thanks.
Re: Communication between two Separate Java Program in the same Computer (Please Help
There are several ways to go about doing this, but one that has worked is to use a ServerSocket on one and to connect to the ServerSocket via Sockets on the other. There are several good tutorials that will show you how to do this which can be found with Google.
Other higher level options include using Java remote method invocation or RMI, Jini also called Apache River, Java Message Service or JMS, or even connect with TCP/IP and communicate using HTTP protocol using web services. The possibilities choices here, fortunately or unfortunately, are enormous. For my money, if all I needed is basic rudimentary communication, then I'd go with a simple Socket set up, but if I needed to implement more complex communication then I'd consider using a higher level construct.
1 Attachment(s)
Re: Communication between two Separate Java Program in the same Computer (Please Help
hi "curmudgeon" .
Thanks for answer .
I think I got the wrong speech with this example in my post .
so i'll explain my problem with a new example .
i have a project with three package that in each package is a seperate class with following name :
root Package:
PKG1 -----> InputFrame (CLass)
PKG2 -----> OutputFrame (Class)
PKG3 -----> DisplayFrame (Class)
“InputFrame” class is a simple frame that contain a TextField and a Button and a JTextArea .
“OutputFrame” 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 :
both class “InputFrame” & “OutputFrame” have separate main method Now I want first run main method in class “InputFrame” and enter a text in JTextField in “InputFrame” and then click on the Button “OK” then after this stage run main method in “OutputFrame” now must that Text Entered in JTextField of “InputFrame” in addition to JTextArea in “InputFrame”
display In JTextArea in “OutputFrame” .
Note :
I do not want use Observe Pattern because all objects that must register and notify in Observer pattern thay are in seperate main method and in seperate package and is not in same method main .
Note :
I do not want use a share file between two "InputFrame" and "OutputFrame" Or DataBase .
Note :
I want if “InputFrame” run but “OutputFrame” is not running and i enter a text in JTextFeild in “InputFrame” , after running “OutputFrame” that Entered Text Displaye in JTextArea in Frame of “OutputFrame” .(Offline Message) .
Source code of InputFrame and OutputFrame is Attached .
Thanks.
Re: Communication between two Separate Java Program in the same Computer (Please Help
Please post your code in the forum so it can be seen without a download.
Be sure to wrap the code in code tags:
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.
Re: Communication between two Separate Java Program in the same Computer (Please Help
hi "curmudgeon" .
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