Finally after log time Java 9 is available, now we can download it. On 21st Sep 2017 JDK 9 has been released with enhance featured.
Java is a general purpose, high-level programming language developed by Sun Microsystems in 1995. Lots of application and websites that will not work unless you have Java installed. Java is fast, secure, and reliable.
In this article I will explain how to install Java 9 on CentOS and Fedora.
Download Latest Java
Download the latest Java SE Development Kit 9 from it official web site. You can also type below command to download it.
# 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
Install Java Using Alternatives Command
Now after extracting the archive file type the below command that 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: 1
Congratulation’s! Java 9 has been installed on your system. Now setup the javac and jar command path using alternatives.
# alternatives --install /usr/bin/jar jar /usr/local/jdk-9/bin/jar 2 # alternatives --install /usr/bin/javac javac /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
Check Installed Java Version
Run the below command to verify the installed JAVA version on your
# 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)
Setup Java Environment Variables
All the java based applications uses the environment variables. Now setup the JAVA Environment Variables using below command:
For Setup JAVA_HOME Variables
# export JAVA_HOME=/usr/local/jdk-9
For Setup PATH Variables
# export PATH=$PATH:/usr/local/jdk-9/bin
Now put all above environment variables in /etc/environment file for auto loading on system boot.