Atlantic.Net Blog

How to Install Java (JRE or JDK) on Ubuntu 16.04

Atlantic.Net NOC
by Atlantic.Net (64 posts) under HIPAA Compliant Hosting
Java Illustration by Walker Cahall

Java Illustration by Walker Cahall

Verified and Tested 03/4/16


If you had the option to choose between a base model car or a fully loaded model, which one would you choose?

Both cars will take you from point A to point B, but with the fully loaded car you have additional features that can make rush hour a chill hour.

Well, that’s the same concept when we take a closer look at Java. There are two standard types of installations, JRE (Java Runtime Environment) and JDK (Java Development Kit). Like the base model car, JRE enables the ability to create Java Applications for different types of deployments using minimal core tools to accomplish the task. JDK is a fully loaded Development Kit that has everything that JRE has plus additional resources to create/secure Applications and Applets.


You need a Ubuntu server that is configured with a static IP address.  If you do not have a server already, why not spin up a robust and reliable Cloud Server in under 30 seconds.

Installing Java on Ubuntu 16.04

Before we begin, let make sure that the server is fully updated with the following command:

sudo apt update

After your server has been fully updated, you will need to know what version of Java is currently installed or if it is not installed, with the following command:

java -version

Install Java Open JRE or JDK on Ubuntu 16.04

Once you have verified if Java is installed or not, choose the type of Java installation that you want with one the following:

sudo apt install default-jdk
sudo apt install default-jre

One alternative Java install is with Open JRE 7 and JDK 7 and can be installed with one of the following:

sudo apt install openjdk-7-jre
sudo apt install openjdk-7-jdk

Install Java Oracle JRE or JDK on Ubuntu 16.04

Another alternative Java install is with Oracle JRE and JDK. However, we would need to install additional repositories for a proper installation.

sudo apt install python-software-properties
sudo add-apt-repository ppa:webupd8team/java

Then, you will need to fully update the system with the following command:

sudo apt update

You can also install previous and newer versions of Java by using one of the following commands:

sudo apt install oracle-java6-installer
sudo apt install oracle-java7-installer
sudo apt install oracle-java8-installer

If you have multiple versions of Java installed on your server, then you have the ability to select a default version. Check your alternatives with the following command:

sudo update-alternatives --config java
This is the output after running the Java Alternative script on Ubuntu 16.04

This is the output after running the Java Alternative script on Ubuntu 16.04

Once you have viewed your alternatives, choose the version that you want by selecting the assigned number, and then hit enter.

Setup JAVA_HOME on Ubuntu 16.04

Since many programs now days need a JAVA_HOME environment variable to work properly. We will need to find the appropriate path to make these changes. With the following command, you can view your installs and their path:

sudo update-alternatives --config java

To edit the environment file use your text editor and edit the following file:

sudo nano /etc/profile

Now that you are in the user profile file, add the following code, along with the Path of your installation from the previous step, to the bottom. ( Example: JAVA_HOME=”YOUR_PATH”)

export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-"

Reload the file so all your changes could take effect with the following command:

source /etc/profile

Verify that your implementations are correct with the following command. Confirm :


What Next?

Congratulations! You now have a successfully installed Java on your Ubuntu 16.04 server. Thank you for following along and feel free to check back with us for further updates or check out other helpful Ubuntu How-to’s in our blog.


Atlantic.Net offers cloud hosting services, including HIPAA compliant cloud hosting. Contact us today for more information!

Start Your HIPAA Project with a Free Fully Audited HIPAA Platform Trial!

HIPAA Compliant Compute & Storage, Encrypted VPN, Security Firewall, BAA, Offsite Backups, Disaster Recovery, & More!

Start My Free Trial

Looking for HIPAA Compliant Hosting?

We Can Help with a Free Assessment.

  • IT Architecture Design, Security, & Guidance.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now!
Stevie Gold Award
Inc 500
Global Infosec 2021
28 Year logo
Ehla Badges 2021 Winner
Made In USA

SOC Audit HIPAA Audit HITECH Audit

Case Studies

White Papers


Recent Posts

How to Install Sails.js Framework with Nginx as a Reverse Proxy on Oracle Linux 8
Are Data Breaches In The Cloud Getting Better Or Worse?
How to setup HTTP Strict Transport Security (HSTS) for Apache on Oracle Linux 8
How to Install Kanban Kanboard on Oracle Linux 8
How To Install Kamailio SIP Server on Oracle Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year

New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Dallas, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4


London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom