July 11, 2020 in Tutorial2 minutes

In this tutorial we learn how to install OpenJDK 8 on Ubuntu 18.04 from Ubuntu repository.
First of all update apt package index using the command below.
sudo apt-get updateAlternatively, we can also use apt command below.
sudo apt updateTo get list of available OpenJDK packages we can use command below.
sudo apt search ^openjdk-8We will get output similar to below.

To search OpenJDK packages on Ubuntu we can also use apt-cache command below.
sudo apt-cache search ^openjdkThe output will be a little bit different that what we got from apt search command. You can see sample output of this search below.

In this section we learn how to install OpenJDK 8 on Ubuntu 18.04. We will learn how to setup multiple alternatives of OpenJDK 8 on Ubuntu 18.04.
To install OpenJDK 8 JDK package we can use the command below.
sudo apt-get install openjdk-8-jdkTo install OpenJDK 8 JDK headless package we can use the command below.
sudo apt-get install openjdk-8-jdk-headlessTo install OpenJDK 8 JRE package we can use the command below.
sudo apt-get install openjdk-8-jreTo install OpenJDK 8 JRE Headless package we can use the command below.
sudo apt-get install openjdk-8-jre-headlessIn this tutorial we learn how to setup Java OpenJDK 8 on Ubuntu 18.04. Firstly, we install Java Development Kit (JDK) packages both headless and non-headless. Secondly, We install Java Runtime Environment (JRE) packages both headless and non-headless.
In this section you can find several references to learn more about Java 8.