In this tutorial, we will show you how to install and configuration of Oracle Java 8 on Debian 8 Jessie. Many programs and scripts require java to run, 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 the step-by-step installation of JRE (Java Runtime Environment) and JDK (Java Development Kit) on Debian 8 (Jessie).
Prerequisites
- A server running one of the following operating systems: Debian 8 (Jessie).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
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 the following apt-get
commands in the terminal:
apt-get update apt-get upgrade
Step 2. Installing Java.
First, you need to add the 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 are 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 check the official Java website.