Error Handling


Debugging on Windows

On Windows, when an installer is executed it always generates a log file in the temp directory that contains information about the JRE search sequence and can be used for debugging purposes. The name of the log file starts with i4j_nlog_. If you have a problem with JRE detection or the installer startup, please send this log file along with your support request.

It is also possible to generate this log for the JRE detection of the generated Windows launchers. In order to switch on logging, please define the environment variable INSTALL4J_LOG=yes and look for the newest text file whose name starts with i4j_nlog_ in the temp directory. This is done silently, without notifying the user and is also suitable for situations where launchers are called automatically or repeatedly.

An easier way for a user to create a log file is to start the launcher with the /create-i4j-log argument. The launcher will notify the user where the log is created and will offer to open an explorer window with the log file selected. After the message box, the launcher will continue to start up.

Debugging on macOS

Similar to Windows, macOS launchers also support the INSTALL4J_LOG=yes environment variable definition for debug logging. Rather than writing a log file, they write to the system log. You can display the system log by starting the "Console" application which is located in /Applications/Utilities.

Setting the environment variable can be done by opening a terminal and executing

launchctl setenv INSTALL4J_LOG=yes

Then all newly started applications in the Finder will have this environment variable set. The current terminal will not have it set until you quit the Terminal application and start it again.

Rather than setting the environment variable for all install4j launchers, you can set it for a particular invocation only. To do that, call the Contents/MacOS/JavaApplicationStub inside the application bundle and prefix the call with the definition of the environment variable. For an application bundle "MyApp.app", the call looks like this:

INSTALL4J_LOG=yes MyApp.app/Contents/MacOS/JavaApplicationStub

In this case, the log output will also be written to the terminal. Using /usr/bin/open will not work with this technique, since the latter gets the environment variables from the Finder.

Note that logging only works for GUI launchers and not for command line and service launchers which are implemented as Unix shell scripts. Also, launchers for the Apple JRE (Java 6) do not support logging. There is no command line argument that activates logging, like on Windows.

Error logs

If an exception is thrown in the installer, it prepares an error log and informs the user about its location

You can force the installer to print exceptions to stderr for debugging purposes with the -Dinstall4j.debug=true command line option.

Installation log

Additionally, all installers and uninstaller generate an installation log that can be used for debugging purposes. After a successful installation it is located in [installation dir]/.install4j/installation.log. For uninstallation or if the end of the installation cannot be reached, you can find it in your temp directory if you pass -Dinstall4j.keepLog=true to the installer or uninstaller. The file is prefixed i4j_log. If you would like the installer to log to stderr as well, you can pass -Dinstall4j.logToStderr=true to the installer. Both arguments can also be useful for debug installers and uninstallers, where they have to be passed as VM parameters.

Error handling of Actions

You can define the error handling for every installation or uninstallation action separately. Please find more information in the Screens and Actions help topic.

Return values

The process of an installer returns 0 if the installation was completed successfully, 1 if the installation fails and 83 if the installer could not find a suitable JVM to run. These exit codes are especially useful to check the result of an unattended installer run.