When I run my application using the .jar file, the GUI is displayed and javaw.exe shows up in System Processes in the task manager. But when I run the .jar file again without closing the first one, a second javaw.exe process starts and a second GUI is displayed. How do I stop this? I want there to be only one instance of my application at a time no matter how many times I run the .jar file.
Asked
Active
Viewed 221 times
3 Answers
1
One simple way is to open a socket on a fixed port number. The OS will enforce that only one process may do this.

Bohemian
- 412,405
- 93
- 575
- 722
-1
Register a value in a file, is probably the easiest solution.

Johan Frick
- 1,084
- 1
- 10
- 18
-
In case of crash of the program, how will you again start the application? – S.P Singh Jun 03 '16 at 05:08