You need to add the Backports repository where the OpenJDK 8 package is located.
Add the file /etc/apt/sources.list.d/backports.list
with this content:
# Backports repository
deb http://ftp.debian.org/debian jessie-backports main contrib non-free
(You may replace http://ftp.debian.org/debian with any closer mirror, or even http://httpredir.debian.org/debian.)
Update packages.
# apt update
Install OpenJDK 8.
# apt -t jessie-backports install openjdk-8-jdk
(Maybe you need to install only openjdk-8-jre
package.)
If you have other JDK/JREs installed you may want to use Java 8 by default.
Update alternatives for java
and javac
.
# update-java-alternatives --set java-1.8.0-openjdk-amd64
# update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac