How to Install {Java} in Ubuntu 20.04 LTS/19.10? [Simple Guide]

J

ava: Installing Java on your Ubuntu system is quite easy to do so. You can obtain Java on Linux Ubuntu via several packages that includes JRE, OpenJDK and Oracle JDK. Two OpenJDK packages are included in Ubuntu 20.04 repositories such as Java Runtime Environment (JRE) and Java Development Kit (JDK). Here, we will explain you how to install Java on Ubuntu 20.04 LTS/19.10 by installing default packages and specific versions in an easy and simple manner.

Index:

Installing Java on Linux Ubuntu 20.04 LTS/19.10:

Make sure you logged in as a root user or a user with Sudo privileges.

Installing the Default JRE/JDK:

By default, Ubuntu 18.04 LTS Bionic Beaver includes Open JDK that is an open-source variant of the JRE & JDK.

  • Use this keyboard shortcut CTRL+ALT+T to open the Terminal on Linux Ubuntu.
  • You have to execute the following commands one by one in the Terminal.
  • Copy and paste the below command and click Enter.
  • Type your system password when it is prompted.

Update the Package Index:

Check if Java is already installed:

You will see the below output if it is not installed in your system.

Check if Java is installed
Check if Java is installed

Run the below command to install default JRE:

$
sudo apt install default-jre

  • Press ‘y’ to continue the installation.
Install default JRE
Install default JRE

To install default JDK:

$
sudo apt install default-jdk

  • Press ‘y’ to continue the installation.
Install default JDK
Install default JDK

Installing Specific Versions of OpenJDK:

While we can install the default OpenJDK package, we can also install dissimilar versions of OpenJDK.

Installing OpenJDK 11:

The latest version of Java is Java 11 and it is an LTS version.

Execute the below command:

$
sudo apt install openjdk-11-jdk

Once you installed the default jdk, you will be installed with the newest version.

Installing OpenJDK 8:

Java 8 is the previous Long Term Support version and is still widely supported.

Execute the below command:

$
sudo apt install openjdk-8-jdk

Install OpenJDK 8
Install OpenJDK 8

Check the Java Version:

To test if Java is installed, run the below command:

Check Java Version
Check Java Version

Remove/Uninstall Java:

  • In order to remove/uninstall this application, you just need to execute the following command on your Ubuntu Terminal.
  • Enter your system password for verification.
  • You can uninstall the Java package like any other package installed with apt.

For example, if you want to uninstall the openjdk-11-jdk, then run:

$
sudo apt remove openjdk-11-jdk

Closure:

We hope that this tutorial assisted you on how to install Java on Linux Ubuntu 20.04 LTS Focal Fossa/19.10 Eoan Ermine succinctly. We have explained the installation with clear-cut steps so it will help you the best. Your valuable comments/feedback are highly encouraged as it will be an asset to our write-up. Thanks for visiting Tec Robust Stay tuned for more interesting articles!!

Related Articles:



Need Help? Chat with us