Java

Install Java 9 on CentOS/RHEL


This tutorial will show how to install Java 9 on CentOS/RHEL and set up the necessary environment variables for application development.

Get the Download Link

Visit this link then accept the Oracle’s license agreement. After that, select the RPM package for your Linux/CentOS/RHEL and copy the download link, it should be something like http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.rpm

Installation

First, type the following command on CentOS/RHEL terminal, please note that you should append the copied link between double quotes at the end of the command. Wait until the download completes.

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; 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 that, run the following command in order to install the downloaded rpm package:

sudo yum install jdk-9.0.1_linux-x64_bin.rpm

After the installation is done, you may delete the downloaded rpm package:

rm jdk-9.0.1_linux-x64_bin.rpm

Environment Variables and Validation

The installation through the above steps often automatically performs the necessary changes on the environment for Java 9 development on Linux distribuitions, so unlike Windows, you shouldn’t need to manually set up any environment variables.

So, let’s validate the installation with the following commands:

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)
javac -version
javac 9.0.1

I hope it helps.
Cya!

References

bgasparotto

Recent Posts

Python function decorator

This guide will show you how to create a Python function decorator with a few…

2 years ago

Got permission denied while trying to connect to the Docker daemon socket

This guide will show you how to fix the error Got permission denied while trying…

2 years ago

Python virtual environment on Intellij IDEA

This guide will show you how to create a Python virtual environment on Intellij IDEA…

2 years ago

Find and kill processes on Linux and Mac by port number

This tutorial will quickly show you how to to find and kill processes on Linux,…

2 years ago

Python: Relocation R_X86_64_PC32 against symbol can not be used when making a shared object Error

This guide shows a possible solution for Python error Relocation R_X86_64_PC32 against symbol can not…

2 years ago

Kubernetes useful commands

I condensed below a cheat sheet of Kubernetes useful commands. I will keep updating this…

2 years ago