Follow through this guide to learn how to install Oracle Java (OpenJDK) 13 on CentOS 8. JDK 13 is an open-source implementation of version 13 of the Java SE Platform.
Installing Java (OpenJDK) 13 on CentOS 8
Download Oracle Java (OpenJDK) 13 RPM binary
Navigate to Official Oracle Java 13 downloads page and download the latest Java 13 RPM binary. You can simply get the link and use wget to download it.
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/13.0.1+9/cec27d702aa74d5a8630c65ae61e4305/jdk-13.0.1_linux-x64_bin.rpm
Install Java 13 on CentOS 8
Once you get the RPM binary, you can install it by executing the command below;
dnf localinstall jdk-13.0.1_linux-x64_bin.rpm
Dependencies resolved.
=======================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================
Installing:
jdk-13.0.1 x86_64 2000:13.0.1-ga @commandline 163 M
Transaction Summary
=======================================================================================================================================================
Install 1 Package
Total size: 163 M
Installed size: 308 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : jdk-13.0.1-2000:13.0.1-ga.x86_64 1/1
Running scriptlet: jdk-13.0.1-2000:13.0.1-ga.x86_64 1/1
Verifying : jdk-13.0.1-2000:13.0.1-ga.x86_64 1/1
Installed:
jdk-13.0.1-2000:13.0.1-ga.x86_64
Complete!
Once the installation is done, you should be having the Java files in their right directories.
Verify Java 13 installation
You can run java –version command to check your Oracle Java version.
java --version
java 13.0.1 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
If you have other Java versions installed, you can run the command below to make Java 13 the default Java version.
alternatives --config java
For example, the output below shows that there is only one Java version installed. If there were other versions, you would see them numbered and you would select specific number of a version to make it the default.
There is 1 program that provides 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/java/jdk-13.0.1/bin/java
Enter to keep the current selection[+], or type selection number: ENTER
Create Java Environment Variable
To create Java environment variable, edit the /etc/environment file and add the line below;
echo 'JAVA_HOME="/usr/java/jdk-13.0.1"' >> /etc/environment
Source the /etc/environment file to reload the environment variables.
source /etc/environment
Verify the environment variable setting.
echo $JAVA_HOME
/usr/java/jdk-13.0.1
That is all about how install Java 13 on CentOS 8. Enjoy coding.
You can also check our other guide on installing Oracle Java by following the links below;
Install Oracle Java 12 on Debian 10
Install Java 11 on Debian 9.8/Ubuntu 18.04
Install Oracle Java 11 on Fedora 29/CentOS 7
Install Oracle Java 12 on CentOS 7/Fedora 29
How to Manually Install Oracle Java 12 on Debian 9.8/Ubuntu 18.04