How To Install Oracle Java 7, 8 & 9 (JDK & JRE) on Debian Via Repository

Non of the Ubuntu PPA’s doesn’t work on Debian systems because they are built against specific Ubuntu libraries and WebUpd8 Oracle JAVA PPA contains oracle Java installer scripts, so it works Debian too. Also read about Oracle java & OpenJDK installation, Setup Java environment variables & install Java using java alternatives method on Linux Distribution such as RHEL, CentOS, Ubuntu & Mint, Debian, Fedora & openSUSE.

Note : Don’t install Oracle JAVA 9 in Production Environment which is not released officially because it may contain bugs and it might not include the latest security patches. If you want for any development purpose, then you can use it.

1) Add Oracle Java 8 & 9 Repo

Just Add the below WebUpd8 repository on your debian system to install Oracle Java 8 & 9.

$ sudo nano /etc/apt/sources.list.d/oracle-java-8-9.list

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

Add Signature Key and update system repository index.

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
$ sudo apt-get update

Install Oracle Java 8 & 9

# Install Oracle Java 8 #
$ sudo apt-get install oracle-java8-installer

# Install Oracle Java 9 #
$ sudo apt-get install oracle-java9-installer

Verify Java Version

$ java -version
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)

Setup Java environment variables

# Setup Oracle Java 8 as a Java Environment Variable #
$ sudo apt-get install oracle-java8-set-default

# Setup Oracle Java 9 as a Java Environment Variable #
$ sudo apt-get install oracle-java9-set-default

Accept Oracle license

# For Oracle Java 8 #
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

# For Oracle Java 9 #
echo oracle-java9-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

2) Install Oracle Java 7

Just Add the below WebUpd8 repository on your debian system to install Oracle Java 7.

$ sudo nano /etc/apt/sources.list.d/oracle-java-7.list

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

Add Signature Key, update system repository index & Install Oracle Java

$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
$ sudo apt-get update
$ sudo apt-get install oracle-java7-installer

# If you get old patch release of Oracle Java 7, then run the below command #
$ sudo apt-get install oracle-java7-installer=7u76-0~webupd8~1

Verify Java Version

$ java -version

Setup Java environment variables

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

Accept Oracle license

$ echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

Enjoy…)

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...

Shares
Close
Please support the site
By clicking any of these buttons you help our site to get better