Zulu Community

Solution for issue if an application installer on Windows does not find Zulu JDK

Updated on November 23, 2016 in Zulu on Windows
0 on November 23, 2016

On Microsoft Windows you might have run into the problem of having installed Zulu JDK as MSI package but not being able to use or install applications which require Java.

Most Windows applications access the Windows registry for finding the path to java.exe. This works if the application searches for the registry key “HKLM/JavaSoft/Java Developing Kit” as that one is set by the Zulu JDK MSI package. Though it won’t work if the application is only looking for “HKLM/JavaSoft/Java Runtime Environment” which is currently not set by the Zulu JDK MSI.

If the application offers an installation from a ZIP without automatic detection of the path to java.exe, that approach can be taken to solve the issue.

Another option is the following script, which also helps to install or launch applications which are not available as ZIP or JAR. The script creates the missing registry entries in the 32 bit and 64 bit section of the Windows registry.

The following steps are only needed once after installation of the Zulu JDK MSI package:

  • in Windows Explorer create a new empty file named jrereg.cmd
  • open a text editor on it by right mouse button click and choosing “Edit”
  • copy the code below into the editor and save the file
  • in Windows Explorer again right mouse button click on it and select “Run as Administrator”
  • now application installers or application launchers should be able to find the Zulu JDK

 

file jrereg.cmd:

@echo off
set javahome=
for /f "usebackq tokens=2,* skip=2" %%L in (`reg query "HKLM\SOFTWARE\Azul Systems\Zulu\zulu-8" /v InstallationPath`) do set javahome=%%M
if not defined javahome ( echo Zulu JDK not found! & exit /b)
echo Found Zulu JDK: %javahome%
for %%a in (32 64) do (
   reg add "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment" /v CurrentVersion /d "1.8" /f /reg:%%a
   reg add "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.8" /f /reg:%%a
   reg add "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.8" /v RuntimeLib /d "%javahome%jre\bin\server\jvm.dll" /f /reg:%%a
   reg add "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.8" /v JavaHome /d "%javahome%jre" /f /reg:%%a
   reg add "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.8" /v MicroVersion /d "0" /f /reg:%%a
)

  • Liked by
Reply