Chapter 4. Selecting a system-wide archive Red Hat build of OpenJDK version
Chapter 4. Selecting a system-wide archive Red Hat build of OpenJDK version If you have multiple versions of Red Hat build of OpenJDK installed with the archive on RHEL, you can select a specific Red Hat build of OpenJDK version to use system-wide. Prerequisites Know the locations of the Red Hat build of OpenJDK versions installed using the archive. Procedure To specify the Red Hat build of OpenJDK version to use for a single session: Configure JAVA_HOME with the path to the Red Hat build of OpenJDK version you want used system-wide. USD export JAVA_HOME=/opt/jdk/openjdk-17.0.0.0.35 Add USDJAVA_HOME/bin to the PATH environment variable. USD export PATH="USDJAVA_HOME/bin:USDPATH" To specify the Red Hat build of OpenJDK version to use permanently for a single user, add these commands into ~/.bashrc : To specify the Red Hat build of OpenJDK version to use permanently for all users, add these commands into /etc/bashrc : Note If you do not want to redefine JAVA_HOME , add only the PATH command to bashrc , specifying the path to the Java binary. For example, export PATH="/opt/jdk/openjdk-17.0.0.0.35/bin:USDPATH" . Additional resources Be aware of the exact meaning of JAVA_HOME . For more information, see Changes/Decouple system java setting from java command setting .
export JAVA_HOME=/opt/jdk/openjdk-17.0.0.0.35 export PATH="USDJAVA_HOME/bin:USDPATH" export JAVA_HOME=/opt/jdk/openjdk-17.0.0.0.35 export PATH="USDJAVA_HOME/bin:USDPATH"