What is Java?
Java is a very popular programming language that is used worldwide for numerous programs and services. To run these programs based on Java it is absolutely necessary that Java is installed on the system. In the following you will learn how to install Java on your system for the offered Linux operating systems.
Before starting the actual Java installation, it is important to make sure that the system is up to date. For this we connect to the server via SSH. If you don't know what SSH is and how to use it, please have a look at the following guide: Initial access (SSH)
Once there, the system can be updated with the following command, depending on the operating system:
// Debian sudo apt-get update // Ubuntu sudo apt update // CentOS sudo yum update // OpenSUSE sudo zypper up // Fedora sudo dnf upgrade --refresh
After finishing the preparation, the Java installation can now be started. Depending on the operating system, the following commands must be executed:
sudo apt-get install default-jdk
sudo apt install default-jdk
sudo yum install java-11-openjdk
sudo dnf install java-11-openjdk
You can check if the installation was successful with the java --version command. The output should look similar to the following:
openjdk 188.8.131.52 2020-11-04 OpenJDK Runtime Environment (build 184.108.40.206+1-Ubuntu-0ubuntu1.20.04) OpenJDK 64-Bit Server VM (build 220.127.116.11+1-Ubuntu-0ubuntu1.20.04, mixed mode)
In this case Java 11 was successfully installed on your system. Now you can easily run your Java applications on your system.