How to Install Java 13 on CentOS/RHEL 7/8 & Fedora 30/31

Java is a secure, stable, and well known, general-purpose programming language and computing technology platform with many interconnected capabilities.

To run Java-based applications, you must have Java installed on your server. You mostly need the Java Runtime Environment (JRE), a collection of software components used to run Java applications on the Linux machine.

If you want to develop software applications for Java, you need to install the Oracle Java Development Kit (JDK), which comes with a complete JRE package with tools for developing, debugging and monitoring Java applications and it is an Oracle’s supported Java SE (Standard Edition) version.

Note: If you are looking for an open-source and free JDK version, install the Oracle OpenJDK which provides the same features and performance as Oracle JDK under the GPL license.

In this article, we will show you how to install free Oracle OpenJDK 13 in RHEL 8/7/6, CentOS 8/7/6 and Fedora 30-31 to develop and run Java applications.

Installing Free Oracle OpenJDK 13 in CentOS/RHEL and Fedora

To install open-source Oracle OpenJDK 13, you need to download the production-ready OpenJDK 13 from the official page or run the following wget command to download and install it as shown.

# cd /opt
# wget https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz
# tar -xvf openjdk-13_linux-x64_bin.tar.gz

To check the Java version, you have to use the full location to the binary as shown.

# /opt/jdk-13/bin/java -version
Sample Output
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)

Setup Java Environment Variables

Next, insert Java environment variables and the executable files path into your system $PATH variable, by issuing the below commands. This method ensures that Java environment variables and executables will be accessible system-wide.

# export JAVA_HOME=/opt/jdk-13/
# export PATH=$PATH:/opt/jdk-13/bin

The above JAVA_HOME environment variable sets the directory where Java is installed on your server.

You can also define it in the /etc/environment global shell start-up file as shown.

# vi /etc/environment

Then add the following lines in the file.

# export JAVA_HOME=/opt/jdk-13/
# export PATH=$PATH:/opt/jdk-13/bin

Save the file and close it. Then source it as follows.

# source /etc/environment

And now if you check the JAVA_HOME environment variable and Java version, it should point to the Java installation directory and default version that you want to use.

# echo $JAVA_HOME
# java -version
Check Java Version in CentOS 8

Check Java Version in CentOS 8

Congratulations! You’ve successfully installed the latest version of Oracle OpenJDK 13 in RHEL 8/7/6, CentOS 8/7/6 and Fedora 30-31 to develop and run Java applications.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

23 Responses

  1. srini says:

    Hi ravi,

    i have installed centos 6.4 in desktop mode successfully in m y machine. can able to act as a SVN Server in that machine.

  2. How do I save and exit out of the repo once i have entered the content in?

  3. Andrew says:

    How to install if I’m not a root user? `rpm -Uvh` requires me to be root.

    Thanks.

  4. HM says:

    Is there something wrong with the Fedora package?

    After installing the package with rpm -Uvh jdk-7u25-linux-x64.rpm the following command would not list it:

    alternatives –config java

    Only shows one and that’s openjdk

    java -version gives me open jdk.

    Installing the package again (no errors or warnings the first time) tells me it already installed.

    I’ll try a reboot and see if that helps,.

  5. m says:

    I did everything but it did not work…

    Then tried telnet localhost 8080

    [[email protected] ~]$ telnet localhost 8080
    Trying 127.0.0.1…
    telnet: connect to address 127.0.0.1: Connection refused
    [[email protected] ~]$

  6. rishi says:

    apche tomcat bootstartup error when i service tomcat stop

  7. rishi says:

    127.0.0.1 is apche2 is running but 127.0.0.1:8080 not runny ..unable to connect :(

  8. sadakar says:

    Hi.. I’m very newbi to putty. Even I do not know the usage of linux machine.
    Now I want to learn
    How to install jdk in CentOS release 5.9 (Final) using putty ?
    Could plz. provide step by step procedure ?

    Thanks,
    Sadakar

  9. Marselino says:

    Thank you!

  10. I did everything to get Firefox to recognize the plugin and this doc finally helped. I didn’t know that I had to do alternates in the actual plugin directory.

    Thank You
    Clint

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.