How To Install Oracle Java 8 on Debian Jessie

Install Oracle Java 8 on Debian Jessie

In this tutorial, we will show you how to install and configuration of Oracle Java 8 on your Debian 8 server.  Many programs and scripts require java to run it, but usually, Java is not installed by default on VPS or Dedicated Server.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation of JRE (Java Runtime Environment) and JDK (Java Development Kit) on Debian 8 (Jessie).

Install Oracle Java 8 on Debian Jessie

Step 1. Before we install any software, it’s important to make sure your system is up to date by running these following apt-get commands in the terminal:

apt-get update
apt-get upgrade

Step 2. Installing Java.

First, you need to add webupd8team Java PPA repository in your system:

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

And add the following two lines at the end of the file:

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

Now import the GPG key on your system to validate packages before installing them:

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

Then, you will need to fully update the system with the following command and install it:

sudo apt-get update
sudo apt-get install oracle-java8-installer

Step 3. Verify Installed Java Version.

java -version

Result:

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

Step 4. Configure Java Environment.

In order to let Debian know where Java JDK and JRE is located, we need to set environment variables. Run the following command to set Java environment variables:

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

Congratulations! You have successfully installed Java. Thanks for using this tutorial for installing Oracle Java (JRE or JDK) on Debian 8 system. For additional help or useful information, we recommend you to check the official Java website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!