Tuesday, August 2, 2016

How to install Oracle JDK on Lubuntu 16.04

Java is one of the most important software on almost every platform, there are many important tools for developers that rely on java in order to run, such as android studio, netbeans, eclipse, jenkins, etc.

There are two kind of java that you can install on lubuntu 16.04, the proprietary oracle JDK and the open source open JDK, you can't have both running at the same time on one machine, so you have to choose one.

Alright, enough talking, let's start installing oracle JDK on lubuntu 16.04, if you are looking for how to install open JDK on lubuntu 16.04, read my previous article on how to install open JDK on lubuntu 16.04.

Step by step how to install oracle JDK on lubuntu 16.04
  • add oracle JDK PPA repository through the command line
sudo apt-add-repository ppa:webupd8team/java
  • run apt-get update
sudo apt-get update
  • installl oracle JDK 8
sudo apt-get install oracle-java8-installer
  • add JAVA_HOME environment variable
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
  • check the java installation by running java -version on command line
java -version

By the time i wrote this article JDK 9 is available but not recommended as it still in beta phase, so probably unstable, JDK 8 is more stable and highly recommended, unless you need some features that only available on JDK 9.

If you previously install open JDK, i strongly suggest uninstall open JDK first before following the 'step by step' tutorial above, even though i'm quite sure that it will not conflict with oracle JDK, but just in case.

When you run java -version on the command line, it should look like this:

java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

That means you have oracle JDK currently running on your system.

No comments:

Post a Comment