Last Updated on 15/11/2020
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
jdk-9.0.1_linux-x64_bin.rpmhttp://download.oracle.com/otn-pub/java/jdk/9.0.1+11/
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
- DigitalOcean – How To Install Java on CentOS and Fedora