I am developing a new Java Desktop app. Something like a media player. I want to load most of the resources in the background when the computer starts up. But the users can turn this option off form within the app or using some other utility. So, what I want to do is if a ban instance of the app is already running and the user starts the app again then I can communicate with the already running instance so that it can launch a new window?
Share
The most known way to do that is to open a ServerSocket when first application starts on a well known port.
If ServerSocket fails to load, it’s probably because an instance is already running.
In such a case, you can open a Socket and start to communicate your orders between both instances.
But you can also use far more sophisticated solutions, like Jini or JGroups.