To determine if Java is already installed, enter the following command:
To install JDK 1.8 on Ubuntu, enter the following commands as a user with `root` privileges:
java -version
If the message java: command not found
displays, you must install the Java SDK as discussed in the next section.
See one of the following sections:
See this article on digitalocean.Be sure to install the JDK and not the JRE.
yum -y install java-1.7.0-openjdk
Java version 7 might not be available for all operating systems. For example, you can search the list of available packages for Ubuntu.
add-apt-repository -y ppa:webupd8team/java
apt-get -y update
apt-get install -y oracle-java8-installer
For other options, see Oracle documentation.