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 your 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.
# cd /usr/local # wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" \ http://download.oracle.com/otn-pub/java/jdk/9+181/jdk-9_linux-x64_bin.tar.gz # tar xzf jdk-9_linux-x64_bin.tar.gz
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/ # alternatives --install /usr/bin/java java /usr/local/jdk-9/bin/java 2 # alternatives --config java There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 /usr/local/jdk-9/bin/java Enter to keep the current selection[+], or type selection number:
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/bin/jar 2 # alternatives --install /usr/bin/javacjavac /usr/local/jdk-9/bin/javac 2 # alternatives --set jar/usr/local/jdk-9/bin/jar # alternatives --set javac/usr/local/jdk-9/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" 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
# export PATH=$PATH:/usr/local/jdk-9/bin
Also put all above environment variables in /etc/environment file for auto loading on system boot.