Chapter 3. Selecting an installed Red Hat build of OpenJDK version for a specific application
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 17 was installed using yum : USD JAVA_HOME=/usr/lib/jvm/java-17-openjdk Note The symbolic link java-17-openjdk is controlled by the alternatives command. Do one of the following: Launch the application using the default, system-wide configuration. Launch the application specifying the JAVA_HOME variable:
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" JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.0.0.35-4.el8.x86_64/ mvn --version Apache Maven 3.5.4 (Red Hat 3.5.4-5) Maven home: /usr/share/maven Java version: 17, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.0.0.35-4.el8.x86_64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.18.0-305.19.1.el8_4.x86_64", arch: "amd64", family: "unix"