Last Updated: October 04, 2020
·
46.3K
· Behnam Khanbeigi (yottanami)

Installing Sun JDK on Debian Linux (JAVA)

Installing Sun JDK 8 on Debian:

Download the sun jdk 8 tar file from here
Extract the tar file:

tar -xvzf jdk-8u92-linux-x64.tar.gz

Move extracted folder to this location:

sudo mv jdk1.8.0_92 /usr/lib/jvm/

Install new java source in system:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0121/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0
121/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.8.0_121/bin/javaws 1

Choose default java:

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

java version test:

java -version

Verify the symlinks all point to the new java location:

ls -la /etc/alternatives/java*

Enable Java plugin for Mozilla Firefox (even for Chrome)

sudo ln -s /usr/lib/jvm/jdk1.8.0_92/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins

Update: I have added Java Web Start configuration (Thanks Jack).

Update: I have added Java Plugin configuration for Mozilla Firefox even for Chrome (Thanks shetty).

Reference: https://sagarvasule.blogspot.com/2012/10/ubuntu-1204-install-sun-jdk-6-7.html?m=0

Related protips:

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