How to Install Java SDK on Ubuntu

In this article we will see how to install Java SDK on Ubuntu.

The Java Development Kit (JDK) is an implementation of either one of the Java SE, Java EE or Java ME platforms released by Oracle Corporation aimed at Java developers on Linux, Windows, Mac OS X or Solaris. The JDK includes a private JVM and a few other resources to finish the development of a Java Application.Since the introduction of the Java platform, it has been by far the most widely used Software Development Kit (SDK).

The JDK forms an extended subset of a software development kit (SDK). It includes tools for developing, debugging, and monitoring Java applications. Oracle strongly suggests that now is used the term JDK to refer to the Java SE Development Kit.

How To Install Java SDK on Ubuntu

Follow the steps below to install Java SDK in Ubuntu.

First of all go to Downloads section at Java SE and click the download icon near Java Platform (JDK).

Java SE on Ubuntu

Then in the table shown choose your Linux’s architecture and download it. You must accept the license agreement before you download the file.
After that, you should change directory to /usr/local, then move the .tar.gz archive binary to this directory by typing this command: sudo mv jdk-8uversion-linux-i586.tar.gz /usr/local
Then, unpack the tarball and install the JDK by typing in terminal the following command:
tar zxvf jdk-8uversion-linux-i586.tar.gz
The name of file jdk-8uversion-linux-i586.tar.gz changes according to your file you downloaded.

Then, add or change these two lines in your ~/.profile to point to the installation;

export JAVA_HOME=/usr/local/jdk1.7.0_13
export PATH=$PATH:$JAVA_HOME/bin

Another Way

There is another way to install Java in your system. Webupd8team has created a PPA where we can get Java installers. Run the following commands if you want to get Java in your computer:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

If you want to install Java 8 in your computer, replace the last line of the previous command with:

sudo apt-get install oracle-java8-installer

In case you have multiple versions of Java installed on your machine run the following command:

sudo update-alternatives --config java

If you found this article helpful, like us on Facebook or subscribe at our newsletter on top-right of this page.