Re: Limit Single Instance
- From: "Monique Y. Mudama" <spam@xxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 09:45:34 -0700
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
.
- Follow-Ups:
- Re: Limit Single Instance
- From: Gordon Beaton
- Re: Limit Single Instance
- References:
- Limit Single Instance
- From: Allan Bruce
- Limit Single Instance
- Prev by Date: Re: Beginner CSV error
- Next by Date: Re: Event passing in (Swing) GUI Application
- Previous by thread: Limit Single Instance
- Next by thread: Re: Limit Single Instance
- Index(es):
Relevant Pages
|
|