Last Updated: October 04, 2020
·
476
· thehappycoder

How to install jdk 8 on debian

1. Download the package

wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz

2. Prepare the directory for java

mkdir /opt/jdk

3. Set it up at debian

update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_45/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_45/bin/javac 100

4. Updating java

When you update java you may want to set higher priority (like, 101)

Related protips:

How To Check If JDK Is 32-bit or 64-bit?