Packaging Java JRE 8u101

With Java 8u91 runtime I found that my old recipe no longer worked. Before, I would install JRE by running the exe in a batch file or vbscript wrapper:

jre-7u51-windows-i586.EXE

Params: /s ADDLOCAL=ALL SYSTRAY=0 EULA=0 IEXPLORER=1 JAVAUPDATE=0 AUTOUPDATECHECK=0 JU=0 SPONSORS=0 REBOOT=ReallySuppress

The other way to install it is by extracting the msi from the exe, but you are limited by the parameters available.

[hr style=”1″ margin=”40px 0px 40px 0px”]

The latest method is to create a configuration file and install it as a parameter to the latest exe. Sun’s official instructions are to install it as follows:

[box style=”1″]

jre INSTALLCFG=configuration_file_path

  • jre is the installer base file name, for example, jre-8u05-windows-i586.exe.
  • configuration_file_path is the path to the configuration file.

[/box]

So it would be: jre-8u05-windows-i586.exe INSTALLCFG=C:\temp\java.settings.cfg.

I like to use either a batch or PSADT wrapper for the install and found that the installation would fail if I used:

“%~DP0jre-8u05-windows-i586.exe” INSTALLCFG=”%~DP0java.settings.cfg”

Or in PSADT:

Execute-Process -Path ‘jre-8u05-windows-i586.exe’ -Parameters ‘$dirSupportFiles\java.settings.cfg’

-WindowStyle Hidden

So by looking through the documentation I found this:

[box style=”1″]

After installing the JRE with a configuration file, the installer saves the file (with a subset of options used during install) in one of the following locations in your computer, depending on your operating system:

  • Windows: %ALLUSERSPROFILE%\Oracle\Java\java.settings.cfg
  • Solaris and Linux: /etc/Oracle/Java/java.settings.cfg

[/box]

So what I finds works is to build a script that creates the above folder path, copies the cfg file to it, then runs the install exe. The exe looks for and finds the cfg file in this location.

In PSADT it looks like this:

[box style=”1″]

##*===============================================

##* PRE-INSTALLATION

##*===============================================

Show-InstallationProgress

New-Folder -Path “C:\ProgramData\Oracle\Java\”

Copy-File -Path “$dirSupportFiles\java.settings.cfg” -Destination “C:\ProgramData\Oracle\Java\java.settings.cfg”

##*===============================================

##* INSTALLATION

##*===============================================

Execute-Process -Path ‘jre-8u101-windows-i586.exe’ -WindowStyle Hidden

[/box]

Hope this saves you some grief with the latest Java JRE iterations.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.