How to Install Java on Ubuntu 20.04 LTS Linux

How to Install Java on Ubuntu 20.04 LTS Linux

To install Java on Ubuntu 20.04, you can use the following steps:

  1. First, update the package index:
r‮efe‬r to:lautturi.com
sudo apt update
  1. Install the default OpenJDK package:
sudo apt install default-jdk

This will install the latest version of OpenJDK available in the Ubuntu 20.04 package repository.

Alternatively, you can install a specific version of OpenJDK using the apt-get command. For example, to install OpenJDK 11, you can use the following command:

sudo apt install openjdk-11-jdk
  1. Once the installation is complete, you can verify the installed version of Java using the following command:
java -version

This will display the version of Java that is currently set as the default on your system.

If you want to use a different version of Java, you can update the default version using the update-alternatives command. For example, to set OpenJDK 11 as the default, you can use the following command:

sudo update-alternatives --config java

This will display a list of available Java versions, and you can select the desired version by entering its corresponding number.

Created Time:2017-10-28 21:38:57  Author:lautturi