I think it started with Java 1.6 that a JNLP jar file was included that can let you run a Java web start application or applet in a single instance.

Through the SingleInstanceService class, you application or applet will be able to detect if another instance is run when it is called from a JNLP.

I have not tried this with an applet that is run from an <APPLET> tag but I tested this in an applet if it is called from a JNLP.

Simply implement SingleInstanceListener from your class and initialize it with this code:

And in the newActivation() method, you can put in a message prompt that looks something like this:

Easy, right?

By the way, if this code is run within an IDE, it will return an exception. This will have to be run from a JNLP in order for it to work.

Related Posts Plugin for WordPress, Blogger...