Communication between 2 Standalone Swing applications
Hi all,
I would like to communicate between 2 standalone SWING applications. Like below.
- 2 applications are running in the same system.
- If I action performs in the one application (Ex: if I enter one string value on TextField and press OK button) , I need that string value in the second application .
- If the first application close, then I need notification to 2 application that first application is closed...(some flag)
How can we do it? Does any have idea?
Thanks
Some sort of remoting. Probably the easiest way would be good old RMI, but there are other ways that would make your CV more sexy, such as web services
Sure. RMI is Remote Method Invocation, basically it allows you to call methods on objects which reside in another JVM (almost) as if they were running in the same JVM. You define an interface for the object that you want to remotely call, and then RMI creates an implementation of this interface at the client, which you call the methods on. The RMI mechanism takes care of the network connection and invokes the right methods on the remote object, returning any return values. It's almost trasnparent, except there is an extra exception to be handled in case there's a network failure or similar
A tutorial will explain it better than I just did!