installing 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: where is java installed in ubuntu

readlink -f $(which java)

Example 6: instalar java ubuntu 18.04

OutputCommand 'java' not found, but can be installed with:

apt install default-jre            
apt install openjdk-11-jre-headless
apt install openjdk-8-jre-headless