install java in ubuntu code example

Example 1: install openjdk 8 sdk on ubuntu

sudo apt-get install openjdk-8-jdk

Example 2: install java ubuntu

sudo apt install default-jdk

Example 3: install java ubuntu

sudo apt install default-jre # installs java
sudo apt install default-jdk # installs javac

Example 4: install java ubuntu

sudo apt install default-jre

Example 5: how to install java on ubuntu 18.0.4

$ sudo apt install openjdk-11-jdk

Example 6: install java ubuntu

#Install java in Linux
sudo apt install openjdk-11-jre-headless -y  # version 11.0.10+9-0ubuntu1~20.04, or
sudo apt install default-jre -y              # version 2:1.11-72
sudo apt install openjdk-8-jre-headless -y   # version 8u282-b08-0ubuntu1~20.04
sudo apt install openjdk-13-jre-headless -y  # version 13.0.4+8-1~20.04
sudo apt install openjdk-14-jre-headless -y  # version 14.0.2+12-1~20.04

Tags:

Java Example