How can I make user only run one instance of my GUI application?

Scott Stanchfield

The easiest way is to use RMI to start the app and check to see if it's already running.

The basic structure is this:

  1. The main method of your app checks the RMI registry to see if the app is started. If so, exit.
  2. Otherwise, the main creates an instance of the app (which is a remote object) and registers it in the RMI registry.
  3. The class' constructor creates the GUI and displays it. Alternatively, you could create a "start" method that you call via RMI to start the app.