Table Of Content

Installing and Configuring Java on Ubuntu

View more Tutorials:

1- Introduction

In the post, I show you the way to install Java on Ubuntu (Server or Desktop), using the command.
If you use Ubuntu Desktop, you can open Terminal to execute the commands.

2- Install Java

To install Java easily on Ubuntu, the members of create a Personal Package Archive which helps you to be able to download and automatically set up Java directly from Oracle's website. It supports the java with the version of 6, 7, 8.
Firstly, you run the following command to add PPA (PPA Repository) to your system.
sudo add-apt-repository ppa:webupd8team/java
Note: If you get error: "sudo: add-apt-repository: command not found", run the following commands:
sudo apt-get install software-properties-common

sudo add-apt-repository ppa:webupd8team/java
Then, run the following command to update the set of installment.
sudo apt-get update

Installing Java

To install Java 8, use the command:
sudo apt-get install oracle-java8-installer
Note: Replace number 8 with 6,7,9 or 10 if you want to install Java 6,7,9 or Java 10.
Java has been installed successfully.
You can execute the following command to check the version of Java that has already been installed.
java -version

View more Tutorials: