Blog › Linux · Published 2026-11-26

How to install the JDK on Ubuntu

OpenJDK is in the Ubuntu repositories. List what is available:

apt search openjdk | grep jdk

Install one version (replace 21 with a version you see listed):

sudo apt update
sudo apt install openjdk-21-jdk

Check:

java -version
javac -version

If several versions are installed, choose with:

sudo update-alternatives --config java

Official sources

Need help with your project?
We build websites, systems and automation. Start your project WhatsApp

All articles