How to Install JAVA 8 on Ubuntu 18.04/16.04 with Video Tutorial

In this tutorial we’ll Install Java 8 on Ubuntu 18.04 LTS, 16.04 LTS, 14.04 LTS (and its forks) using PPA. There are two types of JAVA installation available which are JDK and JRE. JDK (Java Development Kit) provides to develop new Java applications, which includes Java compiler. JRE (Java Runtime Environment) provides the runtime environment for any Java application with applets. The Java development kit requires JDK and JRE both should be installed on the system to create new Java Applications.

Follow the steps to Install Java 8 on Ubuntu and its fork :

STEP 1

Adding PPA :

apt-get install -y software-properties-common
add-apt-repository ppa:webupd8team/java
apt-get update

STEP 2

Installing java :

apt-get install oracle-java8-installer

Verify Java version :

java -version

Output will be like this :

root@mysterydata:~# java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

STEP 3 :

Setup JAVA_HOME and JRE_HOME Environment Variable :

It is necessary to add this environment variable in order to run the java apps flawlessly

echo "JAVA_HOME=/usr/lib/jvm/java-8-oracle" >> /etc/environment
echo "JRE_HOME=/usr/lib/jvm/java-8-oracle/jre" >> /etc/environment

End of the tutorial you’ve successfully installed java 8 on Ubuntu based os.

Back to top button