Este contenido no está disponible en el idioma seleccionado.
Chapter 5. Configuring the JAVA_HOME environment variable on RHEL
Some applications require you to set the JAVA_HOME environment variable so that they can find the Red Hat build of OpenJDK installation.
Prerequisites
-
You know where you installed Red Hat build of OpenJDK on your system. For example,
/opt/jdk/11.
Procedure
Set the value of
JAVA_HOME.export JAVA_HOME=/opt/jdk/11
$ export JAVA_HOME=/opt/jdk/11Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that
JAVA_HOMEis set correctly.printenv | grep JAVA_HOME
$ printenv | grep JAVA_HOME JAVA_HOME=/opt/jdk/11Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can make the value of
JAVA_HOMEpersistent by exporting the environment variable in~/.bashrcfor single users or/etc/bashrcfor system-wide settings. Persistent means that if you close your terminal or reboot your computer, you do not need to reset a value for theJAVA_HOMEenvironment variable.The following example demonstrates using a text editor to enter commands for exporting
JAVA_HOMEin~/.bashrcfor a single user:> vi ~/.bash_profile export JAVA_HOME=/opt/jdk/11 export PATH="$JAVA_HOME/bin:$PATH"
> vi ~/.bash_profile export JAVA_HOME=/opt/jdk/11 export PATH="$JAVA_HOME/bin:$PATH"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional resources
-
Be aware of the exact meaning of
JAVA_HOME. For more information, see Changes/Decouple system java setting from java command setting.