I developed a swing based application in java. I am running it through the executable jar. Each time clicking on the jar file it opens the new instance of the appliction.
But I want to open the single instance of the application i.e. If the application is running , then user tries to open another instance it should be display the error or running application only like yahoomessenger,notepad,etc.
Please tell me how it is done in java. send aly sample code or resources regarding this.
I dont know what kind of application you are talking about.
One way of doing it is , Create a ServerSocket object just before your window is made visible. For ex: ServerSocket serverSocket=new ServerSocket(5555);
If the application is already running and if you try to run it again then typically you should get an error saying "Port already in Use".