Runtime API
Controlling the splash screen from your application
If you have enabled a splash screen for your exe4j executable, you usually want to hide it once the application startup is finished. The splash will be hidden automatically as soon as your application opens the first window.
However, you might want to hide the splash screen programmatically or update the contents of the status text line on the splash screen during the startup phase to provide more extensive feedback to your users.
With the exe4j launcher API you can
Hide the splash screen programatically
Invoke the static methodcom.exe4j.Controller.hide()
as soon as you wish to hide the splash screen.Update the status text line
Invoke the static methodcom.exe4j.Controller.writeMessage(String message)
to change the text in the status line.
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.
Receiving startup events in single instance mode
If you have enabled the Allow only a single running instance of the application
checkbox
on the "Executable info->Single instance mode" step, 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.
The scope of the single instance check can be per-user or globally across all users. For the per-user scope, the "Per session" setting controls whether multiple RDP sessions for the same user can support one instance per session or only one instance across all sessions.
In single instance mode, you may want to receive notifications about multiple startups together with the command line parameters. If you have associated your 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.
Startup notifications only work when the same user starts the executable again. With the global scope, a startup of a different user will not produce a startup notification.
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.