e Learning

How to Install Oracle Java JDK 9 on CentOS 7

Java Development KIT contains the capabilities needed to develop java applications as well as run java programs on your computer. JDK 9 is the latest version of the Oracle Java Development Kit.

In this tutorial we will show you how to setup your JAVA development environment on CentOS 7 with Oracle JDK 9. Oracle provides a rpm package so it is quite easy to install Java 9 on CentOS 7.

These are the steps you need to do:

  1. Download the latest version from the Oracle website.
  2. Agree to the license agreements.
  3. Download the rpm package.
  4. Install Java rpm package with yum command.

Download the latest version of JDK 9 from Oracle at https://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html.

Download Java 9 for CentOS 7

Important: For CentOS 7 you need to download .rpm package.

From the command line, you can copy the link to rpm package and use wget command to download the package (You may need to install wget command).

wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.rpm

After you download the JDK installer, from the command line move into the folder where rpm file is located and install the rpm file with yum command.

yum install jdk-9.0.1_linux-x64_bin.rpm

And yum command will do the rest. The Oracle JDK 9 includes both Java runtime environment(JRE) and javac compiler.

How to Install Oracle Java JDK 9 on CentOS 7

Choose prefered JAVA version

If you have multiple java versions installed on your CentOS machine, run update-alternatives command to configure default version.

For java, run:

update-alternatives --config java

For javac, run:

update-alternatives --config javac

To check Java version on CentOS, Type:

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)

To check javac version, Type:

javac -version
javac 9.0.1