Skip to content

install Java on ubuntu desktop for development

Java is a computer programming language and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.

Java is an operating system agnostic programming language providing the ability to develop Java Applications on any operating system.

Java is split out into two different components;

Java Runtime Engine (JRE)

Java Runtime Environment is a plug-in needed for running java programs.

  • It is an implementation of the Java Virtual Machine which actually executes Java programs.
  • The JRE is smaller than the JDK so it needs less Disk space.
  • The JRE can be downloaded/supported freely
  • It includes the JVM , Core libraries and other additional components to run applications and applets written in Java.

Java Development Kit (JDK)

A bundle of software that you can use to develop Java Applications, includes the JRE, set of API classes, Java compiler, Webstart and additional files needed to write Java applets and applications.

  • The JDK needs more Disk space as it contains the JRE along with various development tools.

All that is required to develop Java Applications is the Java Development Kit (JDK) . This quick tutorial will guide you through the process of installing Java JDK on ubuntu 16.04 desktop to enable the development of Java applications on ubuntu.

This tutorial will install OpenJDK , which is the default Java JDK for in the canonical repository.

How to Install the OpenJDK on Ubuntu

To install the OpenJDK simply open the terminal window [key]ctrl[/key] + [key]alt[/key] + [key]t[/key] and execute


How to Set  JAVA_HOME and PATH on Ubuntu

You’ll most likely need to set the JAVA_HOME variable so other applications can find the location of your Java installation.

To find the Java installation path, run the following command:


which will respond with the path to your Java Installation


Copy the path and open /etc/environment in your nano text editor


Enter the following


We now need to ensure that terminal window reads these settings


We can test that this is working by executing the following command


Which should now return with


We can now verify that the JDK has been installed by checking the version information


Which will provide you with details similar too

Latest posts by Gary Woodfine (see all)