How to install Ubuntu on Java

This article explains how to install Java on Ubuntu and its derivatives like Linux Mint. Thanks to UbuntuJavaInstaller, a fully automated Ubuntu Java installer, we can install Java on Ubuntu very fast, simply and effortlessly.

How to install Java on Ubuntu

First we have to begin with downloading the UbuntuJavaInstaller from its GitHub repository. You can download the entire package by clicking on the “Download ZIP” button placed above the file list, on the right side.

Downloading Ubuntu Java Installer

After having the ZIP file downloaded, extract it. You will find between the others the and files. The file contains instructions related to usage of the script and is the Ubuntu Java Installer script itself.

As the next step, you need to download Oracle Java distribution file from Oracle website. Pickup one of the Linux files with .tar.gz extension. The x86 files are for 32bit systems and x64 are for 64bit systems. Before being able to download any files you have to accept Oracle’s license agreement.

Oracle Java Ubuntu

Save the downloaded .tar.gz file in the same directory as the file. Now you are able to begin with the installation.

Enter the terminal and navigate to the directory where the file is located.

Give the script execution permissions with  chmod +x command.

Execute the script with following command:  sudo ./ jdk-8u72-linux-x64.tar.gz . Of course, change the .tar.gz file name with the name of the file that you have downloaded from the Oracle website.

When you press enter, the script will automatically install and configure Java on your Ubuntu. That’s all!

Below is example output from the UbuntuJavaInstaller script:

How to install Java on Ubuntu with UbuntuJavaInstaller

If you want to completely get rid off OpenJDK (open source implementation of JDK), you can execute the script with the –remove-openjdk option.

In example:  sudo ./ –remove-openjdk jdk-8u72-linux-x64.tar.gz

The script beside installing Oracle Java will also purge OpenJDK from your system. Before the script starts removing OpenJDK, it will present you a list of other dependencies that will be removed along with OpenJDK. Make sure to verify this list so you don’t remove any software you want to keep. You can continue the script with entering letter y and pressing enter, or cancel it by entering letter n and pressing enter.

Have it worked for you?

If the script worked for you, take a moment to share it with other readers in the comments! Mention your OS version so we can build a database with compatible systems. Thanks!

Learn more about Ubuntu