Skip to content

Setting Up Java on a Linux Server – Launch Java-Based Applications and Services

Learn how to install Java on various Linux systems to run Java applications smoothly and optimize your environment → Find out more now

12 November 20261 min read19 Views0 helpful

Introduction

Java is an extremely popular programming language used worldwide for countless programs and services. To run these Java-based programs, Java must be installed on the system. Below, you will learn how to install Java on your system for the supported Linux operating systems.

Preparation

Before starting the actual Java installation, you should ensure your system is up to date. For this, we connect to the server via SSH. If you don’t know what SSH is or how to use it, it’s best to check out this guide: First Access (SSH)

Once connected, you can update the system depending on the operating system with the following command:

Code
// Debian
sudo apt-get update

// Ubuntu
sudo apt update

// CentOS
sudo yum update

// OpenSUSE
sudo zypper up

// Fedora
sudo dnf upgrade --refresh

Installation

After preparation, you can start installing Java. Depending on your operating system, run the following commands:

Debian

Code
sudo apt-get install default-jdk

Ubuntu

Code
sudo apt install default-jdk

CentOS

Code
sudo yum install java-11-openjdk

Fedora

Code
sudo dnf install java-11-openjdk

Version Check

You can verify if the installation was successful with the command java --version. The output should look similar to this:

Code
openjdk 11.0.9.1 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode)

In this case, Java 11 was successfully installed on your system. Now you can easily start your Java applications on your system.

FAQ

Frequently asked questions

First, update your system via SSH, then install Java depending on your distribution, e.g., sudo apt-get install default-jdk for Debian or sudo yum install java-11-openjdk for CentOS.
Use the command java --version, which displays the installed Java version.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 Users found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.