java -version
wget --no-cookies --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" "http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73-linux-x64.rpm"
sudo rpm -i jdk-8u73-linux-x64.rpm
java -version
sudo /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_73/bin/java 20000
sudo /usr/sbin/alternatives --set java /usr/java/jdk1.8.0_73/bin/java
java -version
sudo vim /etc/profile
Add inside this file the following lines
export JAVA_HOME="/usr/java/jdk1.8.0_73/"
export PATH=$JAVA_HOME/bin:$PATH
Then save it. Load the configuration immediately using
source /etc/profile
Then finally, check if it works
echo $JAVA_HOME