How to install Oracle Java 8 JDK on Linux Mint Debian Edition

Java_logo_182x247 mint_debian_logo

 

(1) Download the tar.gz (x86 or x64, depending on your platform)of latest JDK from the Oracle web site; (2) extract the content of the tar.gz file into /usr/local/java/ (you will need root privileges); (3) supposing the latest version is jdk1.8.0_25 then run the following commands:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_25/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_25/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_25/bin/javaws" 1

sudo update-alternatives --set java /usr/local/java/jdk1.8.0_25/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_25/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_25/bin/javaws

Update your $JAVA_HOME by adding the following lines at the end of your /etc/profile:

JAVA_HOME=/usr/local/java/jdk1.8.0_25
export JAVA_HOME
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export PATH

Remove an older version

In case you were upgrading from an older version of Java 8 then, supposing the older version was jdk1.8.0_20, run the following commands to remove it:

sudo update-alternatives --remove javac /usr/local/java/jdk1.8.0_20/bin/javac
sudo update-alternatives --remove javaws /usr/local/java/jdk1.8.0_20/bin/javac
sudo update-alternatives --remove javaws /usr/local/java/jdk1.8.0_20/bin/javaws

and then delete the directory /usr/local/java/jdk1.8.0_20.

Remove all the other versions

In case you don’t need any other version of Java in your system, and you only need the latest, then you can safely remove the pre-installed ones by running the following commands:

sudo apt-get purge openjdk-6-jre* && sudo apt-get purge openjdk-6-jdk*

Install the Firefox Java Plugin

To install the Java plugin for Firefox run:

cd  ~/.mozilla/plugins
ln -s /usr/local/java/jdk1.8.0_25/jre/lib/amd64/libnpjp2.so

Restart Firefox and then type “about:plugins” in the location bar to confirm that the Java Plugin is loaded.

Firefox might complain you are not using the latest version of Java. In that case then you’ll have to use the IcedTea browser plugin. To install it run:

sudo apt-get install icedtea-7-plugin
cd  ~/.mozilla/plugins
rm libnpjp2.so
ln -s /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so
Advertisements

2 thoughts on “How to install Oracle Java 8 JDK on Linux Mint Debian Edition

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s