Linux

Install Java on Ubuntu 20.04 with apt package manager

Pinterest LinkedIn Tumblr

Java and JVM (Java Virtual Machine) are required for many types of popular software, including Tomcat, Jetty, Glassfish, Cassandra and Jenkins.

check if Java is already installed:

java -version

First, update the package lists:

sudo apt update

Install OpenJRE:

sudo apt install default-jre

Type y (yes) and press Enter to resume installation.

Confirm Java version:

java -version

You may need the Java Development Kit (JDK) in addition to the JRE in order to compile and run some specific Java-based software. To install the JDK, execute the following command, which will also install the JRE:

sudo apt install default-jdk

Verify that the JDK is installed by checking the version of javac, the Java compiler:

javac -version

I am a Devops Engineer, but I would describe myself as a Tech Enthusiast who is a fan of Open Source, Linux, Automations, Cloud and Virtualization. I love learning and exploring new things so I blog in my free time about Devops related stuff, Linux, Automations and Open Source software. I can also code in Python and Golang.

Write A Comment