Re: Limit Single Instance



On 2006-01-31, Allan Bruce penned:
> How can I limit my Java application to be running only once? I want
> to avoid a user being able to run the application twice, instead if
> they try to re-open it then it should show the main JFrame of the
> instance already running. Thanks Allan
>

The typical way to do this (for any app, not just java) is to check
for a lock file on startup. If the lock file exists, don't start the
app. If it doesn't, create one.

I'm not sure about making the first instance pop to the front. I
suspect that would require some OS-specific code.

--
monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
.



Relevant Pages