Web Viewer 12 register Tomcat service with Java 11 gives JAVA_HOME error
search cancel

Web Viewer 12 register Tomcat service with Java 11 gives JAVA_HOME error

book

Article ID: 279485

calendar_today

Updated On: 02-28-2024

Products

Output Management Web Viewer

Issue/Introduction

Migrating Web Viewer 12.1 from Windows Server 2012 to a new Windows Server 2019 server.

After a successful new Web Viewer install the Apache Tomcat service fails to register.
After running the command "service.bat install" from directory C:\Program Files\CA\CA_OM_Web_Viewer\apache-tomcat-8.5.4\bin this message is displayed:

The JAVA_HOME environment variable is not defined correctly

Java 11 is installed JAVA_HOME is set as a System Environment Variable to the value: C:\Program Files\Eclipse Foundation\jdk-11.0.12.7-hotspot\

Environment

Web Viewer 12.1
Windows Server 2019

Resolution

The 8.5.4 service.bat file will issue the message "The JAVA_HOME environment variable is not defined correctly" if it cannot find a java.exe file under directory %JAVA_HOME%\jre\bin i.e. it checks for the presence of this file "%JAVA_HOME%\jre\bin\java.exe".

For Java 11 there is no longer a separate jre directory under either jdk or jre installs. So the error is generated because the directory "C:\Program Files\Eclipse Foundation\jdk-11.0.12.7-hotspot\jre\bin" does not exist and the service.bat cannot find "%JAVA_HOME%\jre\bin\java.exe".

To workaround the problem rename the existing System Environment Variable from JAVA_HOME to JRE_HOME.
If JAVA_HOME is not set as an environment variable the service.bat uses the environment variable JRE_HOME to find java.exe in the directory "%JRE_HOME%\bin".
Support tested that with Java 11 JDK (Eclipse jdk-11.0.12+7) and it was successful.

NOTE: The latest Web Viewer 12.1 Tomcat update to 9.0.84 whose service.bat is updated and will handle the Java directory structure change and the environment variable JAVA_HOME can then still be used (service.bat automatically sets JRE_HOME to JAVA_HOME). The Java directory structure changed in Java 9.

Additional Information

Web Viewer 12.1 solutions page for Windows: Output Management Web Viewer WINDOWS-ALL 12.1