Chapter 3. Selecting an installed Red Hat build of OpenJDK version for a specific application
Some applications require a specific Red Hat build of OpenJDK version to run. If multiple versions of Red Hat build of OpenJDK are installed on the system using the yum
package manager or portable bundle, you can select a Red Hat build of OpenJDK version for each application where necessary by setting the value of the JAVA_HOME
environment variable or using a wrapper script.
Prerequisites
- Multiple versions of Red Hat build of OpenJDK installed on the machine.
- Ensure that the application you want to run is installed.
Procedure
Set the
JAVA_HOME
environment variable. For example, if Red Hat build of OpenJDK 11 was installed usingyum
:$ JAVA_HOME=/usr/lib/jvm/java-11-openjdk
NoteThe symbolic link
java-11-openjdk
is controlled by thealternatives
command.Do one of the following:
Launch the application using the default, system-wide configuration.
$ mvn --version Apache Maven 3.5.4 (Red Hat 3.5.4-5) Maven home: /usr/share/maven Java version: 11.0.9, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.el8_0.x86_644/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.18.0-144.el8.x86_64", arch: "amd64", family: "unix"
Launch the application specifying the
JAVA_HOME
variable:$ JAVA_HOME=/usr/lib/jvm/java-11-openjdk mvn --version Apache Maven 3.5.4 (Red Hat 3.5.4-5) Maven home: /usr/share/maven Java version: 11.0.9, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.el8_0.x86_64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.18.0-144.el8.x86_64", arch: "amd64", family: "unix"