To install Java in RHEL or Oracle Linux based Desktop machine, open a browser and navigate to Java SE official download page and grab the latest .rpm binary package in your system.
Install Java JDK / JRE
After Java .rpm file download completes, navigate to the directory where Java package has been downloaded and install Java JDK/JRE by issuing the below command
# yum install jdk-<Version>_linux-x64_bin.rpm
# yum install jre-<Version>_linux-x64_bin.rpm
Setup Java Environment Variables
Next, insert Java environment variables and executable files path into your system $PATH variable by issuing the below commands
This method ensures that Java environment variables and executable will be accessible system wide
-------- Set JAVA_HOME and Path Variable JDK --------
# export JAVA_HOME=/usr/java/jdk-<Version>
# export PATH=$PATH:/usr/java/jdk-<Version>/bin
-------- Set JAVA_HOME and Path Variable JRE --------
# export JAVA_HOME=/usr/java/jre-<Version>
# export PATH=$PATH:/usr/java/jre-<Version>/bin
Check Java JDK / JRE Version
# java --version
java <Version{
Java(TM) SE Runtime Environment (build <Version>)
Java HotSpot(TM) 64-Bit Server VM (build <Version>, mixed mode)
Install Java JDK / JRE
After Java .rpm file download completes, navigate to the directory where Java package has been downloaded and install Java JDK/JRE by issuing the below command
# yum install jdk-<Version>_linux-x64_bin.rpm
# yum install jre-<Version>_linux-x64_bin.rpm
Setup Java Environment Variables
Next, insert Java environment variables and executable files path into your system $PATH variable by issuing the below commands
This method ensures that Java environment variables and executable will be accessible system wide
-------- Set JAVA_HOME and Path Variable JDK --------
# export JAVA_HOME=/usr/java/jdk-<Version>
# export PATH=$PATH:/usr/java/jdk-<Version>/bin
-------- Set JAVA_HOME and Path Variable JRE --------
# export JAVA_HOME=/usr/java/jre-<Version>
# export PATH=$PATH:/usr/java/jre-<Version>/bin
Check Java JDK / JRE Version
# java --version
java <Version{
Java(TM) SE Runtime Environment (build <Version>)
Java HotSpot(TM) 64-Bit Server VM (build <Version>, mixed mode)