How to install Oracle JDK 8 on Ubuntu

Connect with

How to install Oracle JDK 8 on UbuntuStep by step process of how to install Oracle JDK 8 on Ubuntu 16, 15, 14 and 12 LTS or Linux Mint systems using PPA. commands to install JDK 8 on Ubuntu OS.

1. Add Java 8 PPA to install Oracle JDK 8 on Ubuntu

First of all you need to add webupd8team Java PPA repository in your system and install Oracle Java 8 using following set of commands.

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

2. Add Java 8 PPA (Optional)

following step is optional , if your system is not upated with ppa file you can follow above steps as well instead of directly run installer.
You need to add webupd8team Java PPA repository in your system. Edit a new ppa file /etc/apt/sources.list.d/java-8-debian.list in text editor

$ sudo vim /etc/apt/sources.list.d/java-8-debian.list

and add following content in it.

deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main

3. import GPG key

Now import GPG key on your system for validate packages before installing Oracle JDK 8 on Ubuntu.

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886

4. Verify Installed Java Version

This is the 2nd last steps to install Oracle JDK 8 on Ubuntu. After successfully installing oracle Java using above step verify installed version using following command.

ranjetjha@jha:~$ java -version
ranjeetjha@jha:~$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

5. Configuring Java Environment

In Webupd8 ppa repository also providing a package to set environment variables, Install this package using following command. This is the final steps to install Oracle JDK 8 on Ubuntu.

$ sudo apt-get install oracle-java8-set-default

6. Reference

Oracle JDK 8 Installation steps
Happy learning! 🙂


Connect with

Leave a Comment

Your email address will not be published. Required fields are marked *