download java 8 for ubuntu 18 code example
Example 1: how to install java 8 in ubuntu 16.04
sudo apt-get install openjdk-8-jdk
Example 2: how to install java on ubuntu 18.0.4
$ sudo apt install openjdk-11-jdk
sudo apt-get install openjdk-8-jdk
$ sudo apt install openjdk-11-jdk