"[TUTORIAL]Install Oracle JDK on Linux"

Published: Sun 17 July 2016

In content.

Install Oracle JDK on Linux

Most linux distributions come with OpenJDK installed. This tutorial was written to teach how to install Oracle JDK on Linux.

1)Remove OpenJDK Installation apt-get update && apt-get autoremove --purge openjdk*

2)Download latest Oracle JDK. Look for linux version ending with tar.gz. Download for 32-bit or 64-bit.

3)Change into Downloads directory cd Downloads/

4)Extract tarball(downloaded file) tar -xvzf jdk*

5)As a root, create java folder in /opt sudo mkdir -p /opt/java

6)Move extracted folder into created folder mv jdk /opt/java

7)Make Oracle JDK as default sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk/bin/java" 1 sudo update-alternatives --set java /opt/java/jdk/bin/java

Test your installation by running following command: java --version