Lots of applications I've written in C++ start out by checking to see if there's already an instance of the application running, and if so, bringing that instance's main window to the foreground, at which point, the second instance exits.
I want to have similar functionality in my Java Application (stand-alone app, not applet).
First, is there a pure-Java way to achieve this effect?
If not, I will increase the value of this question to 200 points if you have a good JNI native implementation.
One thought I had was to try and get a Process object for the current JavaVM process and store that as a desktopProperty on the default Toolkit. However, you can only get Process objects from the Runtime for sub-processes that you spawn via exec(). And, you can't call Toolkit.setDesktopProperty() because it's protected.
Thanks for your help. If your native code solution works, I'll increase the value of this question before I grade it.