Monday, 12 September 2016

How to Install Java 8 in Ubuntu 16.04

This article is particularly tested for Java 8 on Ubuntu 16.04 LTS running in a Virtual Box. 

How to install Java 8 in Ubuntu 16.04 LTS



If you are trying to install Oracle Java 1.8 in Ubuntu 16.04 LTS Xenial Xerus but failing, here's a short and tested tutorial to download and install it. We are installing JDK by using third party PPA from webupd8 team. 

Before installation Java in your Ubuntu system, you can check if you already have it by typing java -version. If you get an output like this, then you can proceed with the below steps. 

$ java -version

The program 'java' can be found in the following packages:
 * default-jre
 * gcj-4.9-jre-headless
 * gcj-5-jre-headless
 * openjdk-8-jre-headless
 * gcj-4.8-jre-headless
 * openjdk-9-jre-headless
Try: sudo apt install <selected package>


The first step is to download and add webupd8 java repository. Open terminal and type the following command,

sudo apt-add-repository ppa:webupd8team/java

ambarish@ambarish:~$ sudo apt-add-repository ppa:webupd8team/java
[sudo] password for ambarish: 
... [skipping in between outputs]
gpg:               imported: 1  (RSA: 1)
OK

sudo apt-get update

ambarish@ambarish:~$ sudo apt-get update
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu xenial InRelease   
... [skipping in between outputs]
Fetched 120 kB in 2s (46.6 kB/s)                   
Reading package lists... Done

The second step is to install Java 8. 

This will download the Oracle JDK installer from Oracle website and invoke the installation process for you. 

sudo apt-get install oracle-java8-installer

ambarish@ambarish:~$ sudo apt-get install oracle-java8-installer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
... [skipping in between outputs]
Oracle JDK 8 installed
Oracle JRE 8 browser plugin installed
Setting up gsfonts-x11 (0.24) ...

Once the download completes, you will have the set up in front of you. Just follow the instructions, accept to terms and conditions and finish. 



This will successfully install Java 8 in Ubuntu 16.04 LTS. Once you are done with the installation, you can validate it by typing the following command in terminal :

java -version

This will show output like this.

ambarish@ambarish:~$ 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)

Tags : How to install Java 8 in Ubuntu 16.04


0 comments:

Post a Comment