java-oracle

How-to installa Java 8 on Debian system.
For Java 7 check this tutorial

System up-to-date

Keep the system up-to-date by running:

# apt-get update
# apt-get upgrade

Download JAVA 8

Always get the latest JAVA version from here and make sure you tune the URLs/Paths in the commands as well. I’ll try to keep the article up-to-date but just don’t relay on that 🙂

for 64bit system, use the following command to download JAVA JDK8

# wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz" \
-O /tmp/jdk-8-linux-x64.tar.gz

for 32bit system use the following instead:

# wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-i586.tar.gz" \
-O /tmp/jdk-8-linux-i586.tar.gz

Installing JAVA 8

Unpack the downloaded JAVA 8 archive in /opt

mkdir /opt/java-oracle

for 64bit system, use:

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

for 32bit system, use:

# tar -zxf /tmp/jdk-8-linux-i586.tar.gz -C /opt/java-oracle

Setting-up JAVA 8

Set-up Oracle’s JAVA 8 to be used on the system by using higher priority with update-alternatives

# JHome=/opt/java-oracle/jdk1.8.0_05
# update-alternatives --install /usr/bin/java java ${JHome%*/}/bin/java 20000
# update-alternatives --install /usr/bin/javac javac ${JHome%*/}/bin/javac 20000

re-check ${JHome} is set to the correct directory

Verify or set Oracle’s JAVA 8 to be used as a default JAVA on the system

# update-alternatives --config java

check JAVA version using

# java -version

Enabling browser JAVA 8 plugin

to enable JAVA plugin in chrome/chromium, do

# mkdir /opt/google/chrome/plugins
# ln -sf /opt/java-oracle/jdk1.8.0_05/jre/lib/amd64/libnpjp2.so /opt/google/chrome/plugins/

to achieve the same in firefox run

# test ! -d /usr/lib/firefox-addons/plugins && mkdir -p /usr/lib/firefox-addons/plugins
# ln -sf /opt/java-oracle/jdk1.8.0_05/jre/lib/amd64/libnpjp2.so /usr/lib/firefox-addons/plugins/libnpjp2.so