Connect with us

Hi, what are you looking for?

How to Install Java Ubuntu 20.04 – TecAdmin

Hosting

How to Install Java Ubuntu 20.04 – TecAdmin

Java is the most popular, reliable and platform-independent object-oriented programming language. Your system requires multiple applications that require Java on your system. This guide will help you install stable versions of Java (OpenJDK 11 and OpenJDK 8) or Oracle Java 14 on your Ubuntu 20.04 LTS (Focal Fossa) system. You will also find instructions on how to switch from one version of Java to another.

Installing Java on Ubuntu 20.04

Java 11 is the latest version of the LTS available for installation. The standard Ubuntu package repositories contain packages for OpenJDK 11. The default repository also contains packages from previous stable versions of OpenJDK 8. Useful source Linux Server Support.

JDK packages offer extensive Java development libraries that are useful for development systems. To run a Java application you only need a Java Runtime Environment (JRE).

1. Installing OpenJDK 11

To install OpenJDK 11 on your system, run the following command.

sudo apt update
sudo apt install openjdk-11-jdk

Once the installation is complete, you can check the version of Java:

Java version

openjdk version 11.0.7 2020-04-14
OpenJDK runtime environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-bit server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, share)

OpenJDK 11 installed. Continue installing OpenJDK 8.

2. Installing OpenJDK 8

Java 8 is an earlier stable version, most Java applications run on it. To install OpenJDK 8 on your system, run the following command.

sudo apt update
sudo apt install openjdk-8-jdk

Once the installation is complete, you can check the version of Java:

Java version

openjdk version 1.8.0_252
OpenJDK runtime environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09)
64-bit OpenJDK server VM (build 25.252-b09, mixed mode)

You have now successfully installed Java (OpenJDK) on your Ubuntu system.

3. Installation of Oracle Java 14

Oracle Java 14 can be downloaded and installed without a commercial license. You can visit the official download page to download the Debian file to your system. You can also use the following command to load a Debian file from the command line

wget –no-cookies –no-check-certificate –header Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=acceptsecure-backup-cookie https://download.oracle.com/otn-pub/java/jdk/14.0.1+7/664493ef4a6946b186ff29eb326336a2/jdk-14.0.1_linux-x64_bin.deb.

If the above command does not work or if you did not find a file by accident, please go to the official download page. Check the current version and download it to your system.

Once you have downloaded the Debian file, install it on your system using the command below:

sudo dpkg -i jdk-14.0.1_linux-x64_bin.deb

With the above command you can install Oracle java 15 on your system. All files are stored in the /usr/lib/jvm directory. Now install an alternative link to the newly installed Java in your system.

Modifiers –install /usr/bin/java java /usr/lib/jvm/jdk-14.0.1/bin/java 100

Oracle java 14 is installed on your system. In the next step you can switch between the Java versions of your system.

Switching between different versions of Java

Most Unix/Linux based systems allow multiple versions of Java to be installed on the same system. If you have multiple versions of Java installed on your system, you can customize the standard version of Java to suit your needs.

The update alternatives allow you to support symbolic links for standard commands. To change the default version of Java, execute the command on the terminal :

Modifiers –configure java

This will give you a list of all Java binaries installed on your system. Enter the number to select the default Java version and press Enter. See screenshot below:

How to Install Java Ubuntu 20.04 – TecAdmin

If the above command is successful, run the Java version command again to display the current Java version by default.

Java version

java version 14.0.1 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-bit Server VM (build 14.0.1+7, mixed mode, sharing)ubuntu 18.04 install java 8,uninstall java 11 ubuntu

You May Also Like

Hosting

Malware maker urges judge to dump lawsuit over WhatsApp phone snooping Hey boss, this is what people imagine when they think of California –...

Hosting

Servers can be unpredictable, hence your sites! The website may break down for reasons such as incorrect file processing, authorization problems, website updates, etc....

Hosting

We’re at the end of the house! The best host company that has been active in this field for the past 6 years. Because...

Hosting

Youtube-dl is my favorite and preferred command line download manager. I often use it to download audios, videos and movies from Internet. Today, I...