How to Install Java on Ubuntu 20.04
Java, along with its software development kit (SDK) and Java Virtual Machine (JVM) are required for not only development purposes, but also for running any Java based software on Ubuntu.
In this article, we will see the various ways with which we can install Java on Ubuntu 20.04. While there are a number of Java implementations available on Ubuntu, we will be installing the OpenJDK implementation.
OpenJDK 11 is the latest OpenJDK version available in Ubuntu 20.04 repositories. The package is
openjdk-11-jre. This package installs the Java Runtime Environment required for Java apps to run.
sudo apt install openjdk-11-jre
If you want to use Java for development, install the package
sudo apt install openjdk-11-jdk
Apart from these, many other related packages can be installed for documentation, debugging, demoes, etc. Run
apt search openjdk-11 to get list of all related packages.
To verify if the Java Runtime Environment is successfully installed, run:
Similarly to verify if the Java Development Environment is successfully installed, run:
javac stands for Java Compiler.
You can now install Java based Apps and also develop Java Apps on your machine.