Jump to content
Excelsior Forums

Single Instance

Recommended Posts

I am trying to make sure only one copy of my java program is running at a time.

After a quick search I came across the "lock file" trick...

FileLock lck = new FileOutputStream(flagFile).getChannel().tryLock();

if(lck == null) {

   JOptionPane.showMessageDialog(this, "A previous instance is already running....", "Settings",JOptionPane.WARNING_MESSAGE);



This works fine as a jar, but when I compile it using Jet 3.6 it stops.

Any suggestions?

Share this post

Link to post
Share on other sites