How To Install OpenJDK 8 on Ubuntu 18.04
Posted on July 11, 2020 (Last modified on July 14, 2022) • 2 min read • 309 wordsIn this tutorial we learn how to install OpenJDK 8 on Ubuntu 18.04. We will learn installing both JDK and JRE, both headless and non-headless.
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 update
alternatively, we can also use apt
command below.
sudo apt update
To get list of available OpenJDK packages we can use command below.
sudo apt search ^openjdk-8
We will get output similar to below.
To search OpenJDK packages on Ubuntu we can also use apt-cache
command below.
sudo apt-cache search ^openjdk
The 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-jdk
To install OpenJDK 8 JDK headless package we can use the command below.
sudo apt-get install openjdk-8-jdk-headless
To install OpenJDK 8 JRE package we can use the command below.
sudo apt-get install openjdk-8-jre
To install OpenJDK 8 JRE Headless package we can use the command below.
sudo apt-get install openjdk-8-jre-headless
In 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.