Run below command to install JAVA
yum install java-1.8*
Once the installation is completed, run below command to check JAVA Version.
java -version
Above command should give you the following result.
openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-b09) OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
Run below command to find the JAVA path.
find /usr/lib/jvm/java-1.8* | head -n 3
Above command should give you the following results.
/usr/lib/jvm/java-1.8.0 /usr/lib/jvm/java-1.8.0-openjdk /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64
Use last path from above result to update the bash profile.
To update the bash profile run below command.
vi .bash_profile
Update bash_profile as below.
JAVA_HOME = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64 PATH=$PATH:$JAVA_HOME:$HOME/.local/bin:$HOME/bin
Save and Exit the bash_profile.
Refresh the bash profile using the below command.
source ~/.bash_profile
After refresh, run the following command to verify the JAVA path.
echo $JAVA_HOME
Output of the above command should be:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64