You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Welcome today’s guide on how to install Java 13 on CentOS 7/6 & Fedora 31/30/29. Java 13 reached General Availability on 17 September 2019. Production-ready binaries are available from Oracle for Java SE Development Kit 13 on. This is the latest release of Java as of this writing.

JDK 13 is the open-source reference implementation of version 13 of the Java SE Platform as specified by by JSR 388 in the Java Community Process. Install JDK | OpenJDK 13 on your CentOS 8/7 & Fedora 31/30/29 using the next steps.

Option 1: Install OpenJDK 13 on CentOS 8/7 & Fedora 31-28

Visit JDK 13 releases page to download the latest archive.

sudo yum install -y curl
curl -O

Extract downloaded file using tar command.

tar xvf openjdk-13_linux-x64_bin.tar.gz

Move the resulting folder to /opt directory.

sudo mv jdk-13 /opt/

Configure Java environment:

sudo tee /etc/profile.d/ <<EOF
export JAVA_HOME=/opt/jdk-13
export PATH=\$PATH:\$JAVA_HOME/bin

Source your profile file and check java command

source /etc/profile.d/

Confirm Java version.

$ echo $JAVA_HOME

$ java -version
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)

Option 2: Install Java SE Development Kit 13 on CentOS 8/7 & Fedora 31-29

If you choose to go with Java SE Development Kit 13, download RPM package for CentOS / RHEL / Fedora system using the command below.

 curl -LO -H "Cookie: oraclelicense=accept-securebackup-cookie" \

Install RPM package using the yum command.

$ sudo yum localinstall jdk-13_linux-x64_bin.rpm
Loaded plugins: fastestmirror
Examining jdk-13_linux-x64_bin.rpm: 2000:jdk-13-13-ga.x86_64
Marking jdk-13_linux-x64_bin.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package jdk-13.x86_64 2000:13-ga will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                       Arch                          Version                            Repository                                    Size
 jdk-13                        x86_64                        2000:13-ga                         /jdk-13_linux-x64_bin                        308 M

Transaction Summary
Install  1 Package

Total size: 308 M
Installed size: 308 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2000:jdk-13-13-ga.x86_64                                                                                                        1/1 
  Verifying  : 2000:jdk-13-13-ga.x86_64                                                                                                        1/1 

  jdk-13.x86_64 2000:13-ga                                                                                                                         


Confirm Java version installed

$ java -version
java version "13-ea" 2019-09-17
Java(TM) SE Runtime Environment (build 13-ea+33)
Java HotSpot(TM) 64-Bit Server VM (build 13-ea+33, mixed mode, sharing)

Configure Java environment.

cat <<EOF | sudo tee /etc/profile.d/
export JAVA_HOME=/usr/java/default
export PATH=\$PATH:\$JAVA_HOME/bin

To use Java Home, source the file.

source /etc/profile.d/

Test Java Installation

Create a HelloWorld Java program.

$ cat 
public class HelloWorld {

    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World");


Compile Java code.

$ javac

Run your Java program.

$ java HelloWorld
Hello, World

Choosing Default Version of Java

If you have more than one version of Java installed, you can set default one using alternatives command.

sudo alternatives --config java

Select Java to set as default.

Enjoy your Java Development.

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF