How to Install Java on Ubuntu 18.04?

Java is a programming language developed by Sun Microsystems. There are lots of applications and websites which require Java to run. 

In this article, we will show you how to install Java on Ubuntu 18.04 via the steps listed below – 

1. Log in to your server with the root user.

2. Update your system using the apt-get update command. 

# apt-get update -y

3. Now execute the following command, which will install the Java runtime environment and install JRE from open JDK 11 – 

# sudo apt install default-jre   

4. Once the installation is complete, you can verify it using the following command –  

# java -version   

It will show the output, as depicted in the image below if the installation is successful –

Java installed

Was this answer helpful?

« Back