Media File Wizard: Bundled JRE

  In this step of the media file wizard you define if an how a JRE should be bundled with the installer.
  If you choose to bundle a JRE by selecting the "bundle the following JRE" radio button, you have to choose a JRE from the drop down list below it. If you select "manual entry" in the drop down list, a text field will appear where you can enter a file name with compiler variables. If you enter a relative file name, it will first be checked whether that file exists relative to the install4j project file. If not, it will be searched in $INSTALL4J_HOME/jresand {user home directory}/.install4j7/jres. The existence of this bundle file will be checked only at compile time, not by the wizard.

You can download additional JREs with the JRE download wizard. Click JRE download wizard to download the JREs you need. The drop down list will be updated after the download has finished.

If you wish to bundle a JRE that is not available from ej-technologies' download server or that has custom modifications (like an installation of the javax.comm API), please see the JRE bundle creation wizard on how to create your own JRE bundle.

  Further options and runtime behavior are different for installers and archives:
  • Installers:
    The Bundle type section allows you to choose between the two JRE bundling modes offered by install4j:
    • Static bundle
      The selected JRE will be distributed in your media file. install4j will automatically adjust the JRE search sequence of all generated launchers and include the bundled JRE as the first choice.

      A statically bundled JRE will always be distributed inside the installation root directory, on Windows and Linux/Unix in the directory jre and on macOS in [content directory]/.install4j/jre.bundle. The content directory is available from the installer runtime variable sys.contentDir. and resolves to the installation directory for folder media file types and Contents/Resources/app for archive media file types. The actual location of the JRE installation directory is available from the installer runtime variable sys.preferredJre after the "Install files" action has run.

      When you update your application and include a static JRE bundle again, the old JRE bundle will be deleted prior to installation, so that any files left over from the old JRE cannot interfere with the new JRE.

    • Dynamic bundle
      A dynamic bundle is downloaded on demand. If the user already has a suitable JRE installed, that JRE will be used. If there is no such JRE available on the target machine, the installer will download the dynamically bundled JRE from the URL that you specify in the text fields below.

      To enable the download on demand, you have to locate the corresponding .tar.gz bundle archive in the jres subdirectory of your install4j installation and place it on a server so that the HTTP download URL will point to the bundle archive. The URL has to be of the form

      If the installer determines that there is no suitable JRE present, it will ask the user whether the JRE should be downloaded. If the Start download without user confirmation, if necessary check box has been selected, that confirmation is skipped and the download starts immediately.

      • On Windows, a progress bar with download speed and estimated duration will be displayed during the download.
      • On Unix-like systems, the progress will be shown in the terminal. Adding an FTP download URL will increase the chance that the download will work on Unix-like systems behind restrictive firewalls.

      If the download fails or is aborted by the user, the download URL will be displayed together with instructions on where to place the downloaded bundle archive.

      You can override the default JRE search in a Microsoft Windows installer executable by passing the argument -manual to the installer executable. The installer will then report that no JRE could be found and offer you to locate one in your file system. If you have set up a dynamic JRE bundle, it will also offer you to download one. This is a good way to test if your download URL is correct.

    The check box install as a shared JRE determines whether the bundled JRE should be private for the application or whether other applications distributed with install4j can share this JRE. The following scenarios are covered by this approach:

    • If you distribute several applications with dynamically bundled JREs, installing as a shared JRE is advisable, since the user will have to wait for the download only once.
    • If you have a main application and several add-on applications, it makes sense to statically bundle the JRE with the main application and install it as a shared JRE, so the add-on applications can be distributed without JRE.

    Note: installers generated by install4j will never install a JRE on the system path or make Windows registry changes. The term "shared installation" only applies to applications distributed with install4j. Other applications will not be able to use such a JRE.

  • Archives:
    install4j will automatically adjust the JRE search sequence of all generated launchers and include the bundled JRE as the first choice. The JRE will always be distributed in the directory jre right below the installation root directory.