How to install Java on the different Linux distributions?


Java is a programming language and at the same time an important platform It works on most modern operating systems.

It is used for various purposes and it is an almost essential complement for the execution and operation of various tools.

OpenJDK is an open source community version of Java. It is widely used because it is available by default in Ubuntu and many Linux distributions.

However, it cannot be used to develop commercial applications. Java is an object-oriented programming language owned by Oracle. It is a compiled language, with its own rules and widely disseminated at the educational and professional levels.

Due to its license, Java is not installed by default in most Linux distributions. With that, in order to have Java in your distribution, you must install it on your own.

Java is compatible with Linux, this means that it is possible to run and build applications from your favorite distribution.

Installing Java on the different Linux distributions

As mentioned, Java installation on different Linux distributions is different on each oneTherefore You must follow the instructions that we share with you, according to the Linux distribution you are using.

To install Oracle Java 11 on Ubuntu 18.10 and its derivatives and still be able to automatically receive future updates from it, we must do the following:

Ubuntu and derivatives

In the case of Ubuntu 18.10, Ubuntu 18.04 and derivatives, we are going to open a terminal in the system, You can use the CTRL + ALT + T keys as a shortcut and in the terminal we are going to type the following command to add the repository to the system:

sudo add-apt-repository ppa:linuxuprising/java

Once this is done, we must refresh the repositories and packages with the command:

sudo apt-get update

Finally we can install Java with:

sudo apt install oracle-java11-installer


If they are Debian users or any distribution based on it such as Neptune OS, Deepin OS and others,  We must open a terminal and perform a few steps before directly installing Java on our system.


On the terminal we are going to type:

sudo -i
apt install wget libasound2 libasound2-data

Done this now we are going to download the Java 11 deb package with:

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" \

Finally we install with:

dpkg -i jdk-11_linux-x64_bin.deb

Done this now we are going to set Java 11 as the default version:

update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-11/bin/java 2
update-alternatives --config java

Arch Linux and derivatives

In the case of those who are users of Arch Linux, Antergos, Manjaro or any other distribution derived from Arch Linux, they can perform the java installation in a fairly simple way.

All you need to do is have the AUR repository added to your pacman.conf file and have a wizard to install AUR packages on your system.

If you don't have one, you can use the one I recommend you in the next post.

Now you simply have to open a terminal and execute the following command:

yay -S jdk

And ready, You just have to wait for the compilation of this to be done and it will ask you at the end to type your password to perform the installation.

RHEL, CentOS, Fedora, openSUSE and derivatives

In the case of those who are users of distributions with support for RPM packages can install Java on our system with the help of the following package, which we are going to download with the help of our terminal:

wget "" -O java11.rpm

Now To start with the installation, in the only case of openSUSE we are going to install the package with:

sudo zypper install java11.rpm

Finally, To install on Fedora, RedHat and their derivatives, you can do it with the following command:

sudo yum localinstall java11.rpm

Or with this command they can also do it:

sudo dnf install java11.rpm

How to check if java was installed correctly?

After having done a correct Java installation on our system, We can check that we have Java version 11 installed on our system with the following command:

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.


    THANKS!!!! Well, I did not look for a good repository to install java when I had to do according to what things with the state or regional administration ... This post is GOLD. I'm saving it for when I need it again. Let's see if this time I can get everything to work on Linux without having to boot into Windows or Mac.