Published February 21, 2018 by

Install Oracle JAVA 9 on CentOS/RedHat

Oracle JAVA 9 stable release version is available to download and install.This tutorial will show you step by step instructions to install Oracle Java 9 on Centos/RedHat 7 system.
Install Java 9

Download latest Java SE Development Kit 9 release using following commands.

# wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie"   http://download.oracle.com/otn-pub/java/jdk/9.0.4+11/c2514751926b4512b076cc82f959763f/jdk-9.0.4_linux-x64_bin.tar.gz

# tar zxf jdk-9.0.4_linux-x64_bin.tar.gz -C /usr/local

After extracting java file use alternatives command to install it. alternatives command is available in chkconfig package.

# cd /usr/local/jdk-9.0.4/
# alternatives --install /usr/bin/java java /usr/local/jdk-9.0.4/bin/java 2
# alternatives --config java





Setup javac and jar commands path using alternatives:

# alternatives --install /usr/bin/jar jar /usr/local/jdk-9.0.4/bin/jar 2
# alternatives --install /usr/bin/javac javac /usr/local/jdk-9.0.4/bin/javac 2
# alternatives --set jar /usr/local/jdk-9.0.4/bin/jar
# alternatives --set javac /usr/local/jdk-9.0.4/bin/javac

Verify Installed Java Version

# java -version







Setup Java Environment

Setup JAVA_HOME, PATH environment variables

# export JAVA_HOME=/usr/local/jdk-9.0.4
# export PATH=$PATH:/usr/local/jdk-9.0.4/bin

Also insert above environment variables in /etc/environment file.