After a long wait, finally, Java 9 is available to download. JDK 9 has been released on Sep 21, 2017 for general availability with the many featured enhancements. This article will help you to Install JAVA 9 on CentOS/RHEL 7/6 and Fedora 27/26/25 system.
- Install Java 9 on Ubuntu, LinuxMint
- Install Java 8 on Ubuntu, LinuxMint
- Install Java 8 on CentOS, RHEL, Fedora
Step 1 – Download Latest Java Archive
Download latest Java SE Development Kit 9 release from its official download page or use following commands to download from shell.
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
Step 2 – Install Java 9 with Alternatives
After extracting archive 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 There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 /usr/local/jdk-9.0.4/bin/java Enter to keep the current selection[+], or type selection number: 1
At this point JAVA 9 has been successfully installed on your system. We also recommend to setup javac and jar commands path using alternatives
alternatives --install /usr/bin/jarjar /usr/local/jdk-9.0.4/bin/jar 2 alternatives --install /usr/bin/javacjavac /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
Step 3 – Check Installed Java Version
Check the installed Java version on your system using the following command.
[email protected] ~# java -version java version "
9.0.4" Java(TM) SE Runtime Environment (build 9+181) Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
Step 4 – Setup Java Environment Variables
Most of the Java-based applications uses environment variables to work. Set the Java environment variables using following commands
- Setup JAVA_HOME Variable
# export JAVA_HOME=/usr/local/jdk-9.0.4
# export PATH=$PATH:/usr/local/jdk-9.0.4/bin
Also put all above environment variables in /etc/environment file for auto loading on system boot.