a simple way to do this is to create temporary file in known location (user profile could be used for this) when application starts and delete it on exit. App should check if file exists prior to creation.
the singelton pattern only prevents one instance of a class inside the same classloader/inside the same VM. If you start an application (trough: java com.some.MyApp) then you start an new VM and the classes are loaded with a new classloader. the problem with the temp file is that after a crash of the app the temp file might stay on the disk and a restart of the app wont work because the file is present (perhaps the running app could rewrite the file every X seconds or so and if you start the app you check if the file is present AND NOT older that X seconds). Looks ugly to me but i dont have another idea.... good luck
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop