Java, two different ways to install it on Fedora 31

Continuing with this small series of articles what to do after having installed Fedora 31 on our computers successfully, after installing Google Chromenow it's the turn of one of the most essential elements in almost any operating system, which is Java installation.

Many of you will know Java, which is a safe, stable programming language. In addition to being a computer technology and programming language platform with many interconnected capabilities.

Java is an essential component within any operating system since Java must be installed to run Java-based applications. Java Runtime Environment is mostly needed (JRE) which is a collection of software components used to run Java applications on the system.

Although for other cases, if you want to develop software applications for Java, the Oracle Java Development Kit (JDK), which comes with a full JRE package with tools for developing, debugging and monitoring Java applications and is a Java SE compliant with Oracle Standard Edition.

But for the most practical case, we will only install the execution environment, from which we can choose between installing the private version of Oracle or the open source version.

Installing OpenJDK on Fedora 31

For this first case, we are going to install the open source version, which is the OpenJDK and it is found within the repositories of most Linux distributions.

Before installing they should check if they already have java installed, This can be done by opening a terminal in the system and in it they only have to type the following command:

java --version

If it returns something like "openjdk version ..." you already have Java installed on your system. But if it appears to you that it has not been found, we are going to install this.

In the same terminal we are going to type the following commandTo search for packages related to openjdk, you will be shown quite a few options along with their description:

sudo dnf search openjdk

Though basically we have to choose two options, install Java 11 or Java 8. We can install any of them by executing any of the following commands.

Java 11

sudo dnf install java-11-openjdk

Java 8

sudo dnf install java-1.8.0-openjdk

Or if you need to use different versions you can install both, then later you can indicate which one you want to work with.

Done the installation if you installed more than one version and you want to switch between them, you can do this with the following command:

sudo alternatives --config java

With which the different versions will be listed and you can choose between them by typing the version number you want to work with.

Installing Java from RPM or OpenJDK from binaries on Fedora 31

The other installation method we have to install Java on Fedora 31 is from the binaries (OpenJDK only) or the RPM package that we can download from the Java website.

Even though he OpenJDK is available in Fedora repos, OpenJDK version 13 is missing so for those who want to install this version, they must install from this method.

For this we are going to go to the following link to download version 13 of the OpenJDK.

Or from the terminal by typing:

wget https://download.java.net/java/GA/jdk13.0.1/cec27d702aa74d5a8630c65ae61e4305/9/GPL/openjdk-13.0.1_linux-x64_bin.tar.gz

Or in the case of the RPM package this can be downloaded from the following link, accepting the conditions of use.

Done the download of the RPM package this can be installed by double clicking on the downloaded file or from the terminal by typing:

sudo rpm -ivh jdk-13.0.1_linux-x64_bin.rpm

Finally for those who are going to install OpenJDK they must unzip the package with the following command:

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

Later we will move the folder to / opt (where the software you install is usually located):

sudo mv jdk-13 /opt/

And we configure the environment with:

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

And we can confirm the installation by executing:

echo $JAVA_HOME
java --version


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.