How to install the latest JDK 1.8 from Oracle on Debian Linux

this guide is base on

Download jdk 1.8 from here

Unpack the downloaded JAVA 8 archive in /opt

mkdir /opt/java-oracle
tar -zxf /tmp/jdk-8-linux-x64.tar.gz -C /opt/java-oracle

create a symlink with the major release version

ln -fs jdk1.8.0 jdk1.8

set-up oracle’s java 8 to be used on the system, by using higher priority with update-alternatives (NOTE: Adapt the below to match the latest version !!!)

update-alternatives --install /usr/bin/java java ${jhome}/bin/java 2000
update-alternatives --install /usr/bin/javac javac ${jhome}/bin/javac 2000
update-alternatives --install /usr/bin/jconsole jconsole ${jhome}/bin/jconsole 2000
update-alternatives --install "/usr/bin/javaws" "javaws" "${jhome}/bin/javaws" 2000

update-alternatives --install "/usr/lib/mozilla/plugins/" "" ${jhome}/jre/lib/amd64/" 1
IMPORTANT choose the java you installed as default
update-alternatives --config java
update-alternatives --config javac

Updated by Andreas Müller over 1 year ago · 16 revisions