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 -versionFirst, update the package lists:
sudo apt updateInstall OpenJRE:
sudo apt install default-jreType y (yes) and press Enter to resume installation.
Confirm Java version:
java -versionYou 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-jdkVerify that the JDK is installed by checking the version of javac, the Java compiler:
javac -version