how to get java 8 for debian 8.10? (openjdk-8-jre)

I followed this guide How To Install Java with Apt-Get on Debian 8 and it specifically said that this will install OpenJDK 8, the latest and recommended version.

But I get java 7 instead.

apt list --installed | grep jdk

openjdk-7-jre/oldstable,now 7u181-2.6.14-2~deb8u1 amd64 [installed,automatic]
openjdk-7-jre-headless/oldstable,now 7u181-2.6.14-2~deb8u1 amd64 [installed,automatic]

I can neither use apt-get --config java because I only have one version installed.

I looked in /etc/apt/sources.list and found that digitalocean have used their own mirrors by default, so I changed it to the default ones from debian and did apt update, but still no java 8 package available.

I would appreciate some solution to get java 8, thanks!


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey friend,

You may want to go over the tutorial again. I just set up a Debian 8 droplet and followed the tutorial. Java 8 was installed as a result:

root@debian-s-4vcpu-8gb-sfo2-01:~# dpkg --list | grep -i jdk
ii  default-jdk                    2:1.7-52                           amd64        Standard Java or Java compatible Development Kit
ii  openjdk-7-jdk:amd64            7u181-2.6.14-2~deb8u1              amd64        OpenJDK Development Kit (JDK)
ii  openjdk-7-jre:amd64            7u181-2.6.14-2~deb8u1              amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-7-jre-headless:amd64   7u181-2.6.14-2~deb8u1              amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  oracle-java8-installer         8u201-1~webupd8~1                  all          Oracle Java(TM) Development Kit (JDK) 8
ii  oracle-java8-set-default       8u201-1~webupd8~1                  all          Set Oracle JDK 8 as default Java

The tutorial is for Oracle JDK though at that stage (default version of OpenJDK or Oracle for 8/9), not OpenJDK. If it is necessary that OpenJDK be installed over the Oracle one, you may need to install it by hand or use a newer version of Debian that may have it bundled.