Receiving Startup Events In Single Instance Mode


  If you have enabled the single instance mode for your executable, the application can only be started once. For a GUI application, the existing application window is brought to front when a user executes the launcher another time.

However, you might want to receive notifications about multiple startups together with the command line parameters. If you have associated you executable with a file extension, you will likely want to handle multiple invocations in the same instance of your application. Alternatively, you might want to perform some action when another startup occurs.

  With the install4j launcher client API you can write a class that implements the com.install4j.api.launcher.StartupNotification.Listener interface and register it with com.install4j.api.launcher.StartupNotification.registerStartupListener(Listener startupListener). Your implementation of startupPerformed(String parameters) of the Listener interface will then be notified if another startup occurs.

install4j's launcher client API is automatically available to an application deployed with install4j. For compiling your application, you need to add i4jruntime.jar to the classpath. i4jruntime.jar can be found in the resource directory of your install4j installation.