How to Install Oracle Java 8 on Ubuntu 16.04

oracle java

In this tutorial we will show you how to install oracle java on ubuntu 16.04. Java and the JVM (Java’s virtual machine) are widely used and required for many kinds of software. This tutorial will guide you how to install java using simple apt-get command. Ubuntu 16.04 comes with OpenJDK’s java version , but we will install Oracle’s java version, using Oracle java make your java application run more stable. In this tutorial we will using Oracle java version 8 , this is the latest stable version of Java at time of writing, and the recommended version to install.

Prerequisites

This article assumes you have at least basic knowledge of linux, know how to use the shell, root user or non-root user account with sudo privileges set up on your server.

Step 1 – Add custom repositories

Because Oracle Java not comes from official repositories, we need to add custom repositories using ppa command.

Step 2 – Install Oracle Java 8 using apt-get

Begin install Oracle java 8 using apt-get

During installation you will got dialog screen to accept license agreement like these , just choose Yes

oracle java 8

┬áStep 3 – Setting the JAVA_HOME Environment Variable

Many programs, such as Java servers, use the JAVA_HOME environment variable to determine the Java installation location.

To set this environment variable, we will first need to find out where Java is installed. You can do this by executing these command

You will get output like these

Please note that we will use parent directory only , from output above we will use this path only for our environment : /usr/lib/jvm/java-8-oracle/

Edit global environment file (/etc/environment) using nano

Add this line at the end line of file , make sure you got path from command above

Save the file and exit , now we will reload environment using this command

Test your environment variable using these command

You should get output based the path you just set

Congratulation , you have succeeded installed oracle java 8 on ubuntu 16.04 , now you can run or install application based on java like tomcat, jboss, jetty, cassandra, glassfish, or jenkins

 

You may also like...

1 Response

  1. FirstQuentin says:

    I have noticed you don’t monetize your page, don’t waste
    your traffic, you can earn additional cash every month because you’ve got
    hi quality content. If you want to know how to make extra
    money, search for: Mrdalekjd methods for $$$

Leave a Reply

Your email address will not be published. Required fields are marked *