Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to make an app, that has just one instance. Even if the user double clicks a jar 2 times, I want there just to be 1 jframe instance.
Could someone give me any suggestions on how I should do this?
Thanks.
Posted

1 solution

There are many systems, but the most reliable is always the creation of a file that the application locks. Any further trials to create/access the locked file will fail meaning that an instance is already running holding the lock.
Look here[^] for some suggestions. BTW you can find a lot of docs on the subject simply googling...
If you are confortable with mixed programming you can use some C/C++ techniques (i.e. mutex method).
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900