There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java 8 is released with many of new features and security updates, it is also known to perform much better than older versions of Java.
Oracle Java PPA for Ubuntu is maintained by Webup8, we need to add Webup8 repository to APT before we can install Java 8 using apt-get.
sudo add-apt-repository ppa:webupd8team/java sudo apt-get update
Now use the following command to install Java 8 on your Ubuntu server. This will automatically download and install Oracle Java 8.
sudo apt-get install oracle-java8-installer
Webup8 PPA repository provides a package to set Java 8 environment variables, you can install this package by using the following command.
sudo apt-get install oracle-java8-set-default
You can use the following command to make sure that you have Java correctly installed and Java environment is using Java 8.