Installing Oracle JDK 8 , 9 on any Linux distro

Installing Oracle JDK 8 , 9 on any Linux distro

In this tutorial I am going to show you how to install Oracle JDK 8 , 9 or any version in any linux distro like Ubuntu, OpenSuse, fedora,manjaro, deepin, elementary …. , now google’s android studio (Making Android APPs) prefers Oracle JDK 8 onwards instead of Open JDK so its recommended to use Oracle JDK.

Downloading Oracle JDK

First we have to download oracle jdk to your home folder from http://www.oracle.com/technetwork/java/javase/downloads/index.html , choose tar.gz version as it can be install on any linux. Suppose I have downloaded jdk-8u144-linux-x64.tar.gz. Extract using terminal ….

Open Terminal and run command
tar -zxvf filename
in my case command will be
tar -zxvf jdk-8u144-linux-x64.tar.gz

Copy Extracted folder to /opt folder

Now open Terminal and run command (Require Root Privilage)

sudo cp -pr jdk1.8.0_144  /opt

Backup OpenJDK and Rename it

If you have already installed open jdk(to check run on terminal java -version) then follow this process Open Terminal and run command
sudo mv /usr/bin/java /usr/bin/java_backup

Make symlink for all users:

sudo ln -s /opt/jdk1.8.0_144/jre/bin/java /usr/bin/java

Now run java -version in terminal

oracle jdk terminal

Leave a Reply

Your email address will not be published. Required fields are marked *

Do you have any Query / Suggestion