# How to install Oracle Java 8 on Debian 9

**URL:** <https://linux-tips.com/t/how-to-install-oracle-java-8-on-debian-9/731>\
**Category:** Distributions\
**Created:** [March 26, 2019, 8:24am UTC](https://linux-tips.com/t/how-to-install-oracle-java-8-on-debian-9/731 "2019-03-26T08:24:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Debuser](https://linux-tips.com/letter_avatar_proxy/v4/letter/d/96bed5/32.png) [@Debuser](https://linux-tips.com/u/Debuser)\
**Post date:** [March 26, 2019, 8:24am UTC](https://linux-tips.com/t/how-to-install-oracle-java-8-on-debian-9/731/1 "2019-03-26T08:24:59Z")

</div>

Oracle Java 8 required by some programs and it is not available on Debian archive due to licensing issues.

To install Java 8 on Debian Stretch with minimum effort, you can use WebUpd8’s Java PPA repositories. Follow the steps below:

```auto
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
$ sudo add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main"

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

```

If there are other Java/JDK packages on your system, you need to select the default one. Selection can be made with `update-alternatives` command but WebUpd8 repositories also includes a small package which makes setting Java 8 as default more easily. You just need to install the `oracle-java8-set-default` package:

```auto
$ sudo apt install oracle-java8-set-default

```

You can also verify the selection with `update-alternatives --config java` command:

```auto
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection Path Priority Status
------------------------------------------------------------
  0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 auto mode
  1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
* 2 /usr/lib/jvm/java-8-oracle/jre/bin/java 1081 manual mode

```
