How To Install Oracle Java 9 & 8 (JDK) on CentOS, RHEL, Fedora, Arch Linux & openSUSE

JAVA is necessary to run Java based applications in Linux and windows machine. JAVA comes with two packages (JDK & JRE).

JDK stands for (Java Development Kit) which helps developers for developing, debugging, and monitoring Java applications.

JRE stands for (Java Runtime Environment) which deploys Java applications on servers. It included tools for JVM monitoring which commonly required for server applications.

In this article we are going to explain how to install oracle java 9 on CentOS, Fedora, openSUSE, Arch Linux & RHEL. JDK 9 reached General Availability on 21 September 2017, after a long wait. The JDK package contains JRE too, so no need to download separately. openJDK project is sponsor by oracle.

We have already covered few articles about openJDK & Oracle JAVA, hit the below link for further reading.

Suggested Read : openJDK & Oracle JAVA Related Articles

Download oracle java rpm file

Use the below command to download the oracle java 9 rpm file. Make sure oracle uses cookies, so use the wget command according that, like below format. Also check with oracle website for latest version of oracle java 9 & oracle java 8 download

[Download Oracle Java 9]
$ sudo wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" ""

[Download Oracle Java 8 update 152]
$ sudo wget --no-cookies --no-check-certificate --header "Cookie:; oraclelicense=accept-securebackup-cookie" ""

Install oracle java 9/8

Use the below RPM Command to Install oracle java into rpm based systems such as RHEL, CentOS, Fedora & openSUSE.

[Install Oracle Java 9]
$ sudo rpm -ivh jdk-9.0.1_linux-x64_bin.rpm

[Install Oracle Java 8]
$ sudo rpm -ivh jdk-8u152-linux-x64.rpm

Install oracle java 9/8 on Arch Linux

Oracle java is available in AUR repository, so we can easily install on arch Linux based system without any issue using AUR helper such as Yourt or Packer.

[Install Oracle JAVA & OpenJDK]
$ yaourt jdk

The above output will show you the list of available OpenJDK & Oracle JDK and JRE versions. Just type the number of your choice to get install.

Check Installed java version

Enter the following command on terminal to check the installed java version on your system.

$ java -version
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

Setup JAVA Environment Variables

Make sure you have to Setup JAVA Environment Variables for java as java based applications uses environment variables to work. Open the .bashrc file and add the below lines in end of the file and change your path instead of us, if you install through tar.gz archive file then save and exit the file.

$ nano .bashrc

After saving .bashrc file, run the following command to make it work

$ source ~/.bashrc

Now, check the environment value using below command, which clearly fetch the path of jdk home.

$ echo $JAVA_HOME

Prakash Subramanian

Prakash Subramanian is a Linux lover and has 3.5+ years of experience in linux server administration with major Linux distribution such as (RHEL, CentOS, Ubuntu). He is currently working as a Senior L2 Linux Server administrator.

You may also like...

Please support the site
By clicking any of these buttons you help our site to get better