I have created a login page using java swing. and i created jar for the application. Now when I run the jar then my login page is displayed then i minimize the application and again run the jar then another instance of my application is displayed (means now in my system I have two login page. 1 is in minimized format and another is in normal state.
But I want that if in my system login page is already running and is minimized then if i run the jar once again then it will not start as a new application rather it should maximize the earlier login page.
How to achieve this type of functionality ?
please help me
Thanks
Sunil Kumar Sahoo
If you want to only have one instance of an application, open up a server socket at some unusual port if you get a failure then the app is already running so exit.
As far as your exact question, it is impossible for a Swing app to know about another one running without doing some specific code.
I guess you could use the Server Port of the app that is running actually listen and perform some commands. The client app could then detect if the server port is unavailable, then open a client and send a command to the port.