How Installers Find A JRE
Installers generated by install4j are native executables or shell scripts and can start running without a JRE. However, the installer itself requires a JRE in order to perform its work and so the first action of the installer is to locate a JRE that is suitable for both the installer and your application. In this process it performs the following steps:
Look for a statically bundled JRE. If a statically bundled JRE is included with the installer, it will unpack it and use it. First, this JRE is unpacked to a temporary directory, later it is copied to a location that depends on whether the bundled JRE is configured as shared or not.
Not sharedIt is copied to the
jredirectory in the installation directory of your application. No other installer generated by install4j will find this JRE. It will not be made publicly available, for example in the Windows registry.
The JRE is copied to the
i4j_jresdirectory in a common folder which depends on the operating system:
%CommonProgramFiles%on Windows, which typically resolves to
C:\Program Files\Common Fileswith an English locale.
/optif it exists, otherwise
If the above folder is not writable, the
i4j_jresdirectory will be created in the use home directory and the shared JRE will only be shared for the current user.
Other installers generated by install4j will find this JRE. It will not be made publicly available. For each Java version, only one such JRE can be installed. Shared JREs are never uninstalled.
- Look for a suitable JRE in the configured search sequence. The installer uses the same search sequence and Java version constraints as your launchers which are configured for the entire project. The most important search sequence element in this respect is the "Search Windows registry and standard locations" entry. On Windows, the registry contains information on installed JREs, on Unix platforms there is a number of standard locations which are checked, on macOS the location of installed JREs is always the same.
If no JRE has been found, the installer notifies the user
and offers the following options:
- Manually locate a JRE
- Cancel the installation
You can force the installer to skip the first two steps and show this dialog immediately with the
-manualcommand line parameter.