How to Install Java 13 on CentOS 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
# 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.

Brought to you by Web Designer

Leave a Reply

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