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 exe4j launcher API you can
write a class that implements the com.exe4j.Controller.StartupListener interface
and register it with
com.exe4j.Controller.registerStartupListener(StartupListener startupListener) .
Your implementation of startupPerformed(String parameters) of the
StartupListener interface will then be notified if another startup occurs.
The launcher API of exe4j is contained in exe4jlib.jar which can be found in the top level directory of your exe4j installation. Note: you do not have to add it to the classpath of your application and distribute it along with it, since that file is always contained in the executable. |
![]() ![]() ![]() |