Java 11 still anchors older enterprise applications, Spring Boot 2.x services, CI runners, and vendor-certified stacks that are not ready for newer LTS releases. To install OpenJDK 11 on Ubuntu, use Ubuntu’s APT packages rather than managing a manual tarball or vendor archive yourself. APT downloads the right package for your release, keeps it updated through normal system upgrades, and registers the runtime with update-alternatives.
OpenJDK 11 is available from Ubuntu’s archives on Ubuntu 26.04 LTS (Resolute), 24.04 LTS (Noble), and 22.04 LTS (Jammy). Ubuntu 26.04 and 24.04 publish the packages from Universe, while Ubuntu 22.04 publishes them from Main. For new projects, compare the later LTS releases before deciding to stay on Java 11.
Install OpenJDK 11 on Ubuntu
Ubuntu packages OpenJDK 11 as separate runtime, development, and headless variants. Choose one package that matches the system you are building instead of installing every variant.
| Package | Includes | Use When |
|---|---|---|
openjdk-11-jre | Java runtime with desktop support | You only need to run Java applications on a desktop system |
openjdk-11-jdk | Runtime, compiler, debugger, and development tools | You develop Java applications or use build tools such as Apache Maven on Ubuntu |
openjdk-11-jre-headless | Runtime without GUI libraries | Servers, containers, CI runners, and other non-desktop systems |
openjdk-11-jdk-headless | Compiler and runtime without GUI libraries | Headless build servers and minimal images that still need javac |
Update Ubuntu Packages First
Refresh APT before installing Java so Ubuntu uses current package metadata and security updates. The -y flag accepts the upgrade prompt automatically.
sudo apt update
sudo apt upgrade -y
These commands use
sudofor package-management tasks that need root privileges. If your account is not in the sudoers group yet, follow the steps to add a new user to sudoers on Ubuntu before continuing.
Confirm OpenJDK 11 Package Availability
Check the package candidate when you are using a minimal image, a custom mirror, or a system where Universe may be disabled.
apt-cache policy openjdk-11-jdk
Relevant output on Ubuntu 26.04 includes a candidate from resolute/universe. Your mirror hostname may differ, but the release and component should match:
openjdk-11-jdk:
Installed: (none)
Candidate: 11.0.30+7-1ubuntu1
Version table:
11.0.30+7-1ubuntu1 500
500 http://au.archive.ubuntu.com/ubuntu resolute/universe amd64 Packages
If Ubuntu shows Candidate: (none) on 26.04 or 24.04, enable Universe and refresh APT again. The Ubuntu Universe and Multiverse guide explains the repository components in more detail, but OpenJDK 11 only needs Universe.
sudo add-apt-repository universe
sudo apt update
Install the OpenJDK 11 Package
Install the full Java 11 JDK on Ubuntu with sudo apt install openjdk-11-jdk -y when you need both the runtime and compiler. Run only one of the following commands: choose the JRE or headless packages instead when you only need a smaller runtime.
# Full development kit for desktops and general development
sudo apt install openjdk-11-jdk -y
# Runtime only
sudo apt install openjdk-11-jre -y
# Headless development kit for servers and CI
sudo apt install openjdk-11-jdk-headless -y
# Headless runtime only
sudo apt install openjdk-11-jre-headless -y
If you are unsure which package to install, use
openjdk-11-jdk. It includes the runtime and covers development tools such asjavac,jar, andjshell.
Verify OpenJDK 11 on Ubuntu
Check the active Java runtime after installation:
java --version
Ubuntu 26.04 currently returns output similar to the following. The point-release number may be newer on your system after security updates.
openjdk 11.0.30 2026-01-20 OpenJDK Runtime Environment (build 11.0.30+7-post-Ubuntu-1ubuntu1) OpenJDK 64-Bit Server VM (build 11.0.30+7-post-Ubuntu-1ubuntu1, mixed mode, sharing)
If you installed a JDK package, verify the Java compiler too:
javac --version
javac 11.0.30
Manage Java 11 with Other Java Versions
Ubuntu registers OpenJDK packages with update-alternatives. If you install Java 11 beside Java 17, 21, or 25, use the alternatives system to choose which java and javac commands run by default.
List Installed Java Alternatives
List the registered Java runtime paths first:
update-alternatives --list java
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
A system with multiple JDKs installed shows one path per Java version. Use the interactive selector when you need to switch the default runtime:
sudo update-alternatives --config java
If you compile Java code, switch the compiler path as well so java and javac point to the same major version:
sudo update-alternatives --config javac
Find the JAVA_HOME Path
Many build tools, application servers, and IDEs need JAVA_HOME to point at the JDK directory rather than the java executable. Find the active Java home path with:
dirname "$(dirname "$(readlink -f "$(command -v java)")")"
/usr/lib/jvm/java-11-openjdk-amd64
Use that path when a project asks for Java 11 specifically. For persistent shell configuration, follow the dedicated guide to set the Java environment path in Ubuntu.
Compare OpenJDK LTS Releases for Ubuntu
OpenJDK 11 is the right target when an application or vendor support matrix explicitly requires Java 11. For new development, later LTS releases usually give better framework compatibility and newer language features.
| Java Version | Best Fit | Ubuntu Guide |
|---|---|---|
| OpenJDK 8 | Legacy applications that still certify against Java 8 | Install OpenJDK 8 on Ubuntu |
| OpenJDK 11 | Older enterprise apps, Spring Boot 2.x stacks, and Java 11-pinned build pipelines | Current article |
| OpenJDK 17 | Spring Boot 3.x, Jakarta EE 10+, and common modern LTS baselines | Install OpenJDK 17 on Ubuntu |
| OpenJDK 21 | Projects that can use virtual threads and newer Java 21 LTS features | Install OpenJDK 21 on Ubuntu |
| OpenJDK 25 | New projects that want the latest stable LTS feature set | Install OpenJDK 25 on Ubuntu |
Do not migrate a production workload just because a newer JDK exists. Check your framework, application server, and vendor support matrix first, then install the Java line that your project actually supports.
Remove OpenJDK 11 from Ubuntu
Remove the OpenJDK 11 packages when no project on the system needs Java 11 anymore. The command below covers the desktop and headless JDK/JRE variants; APT skips any package that is not installed.
sudo apt remove openjdk-11-jdk openjdk-11-jre openjdk-11-jdk-headless openjdk-11-jre-headless -y
Review unused dependencies before removing them. Shared packages such as certificate or font packages may still be useful to other software, especially on reused desktop systems.
sudo apt autoremove --dry-run
If the dry run lists only packages you no longer need, run the cleanup for real:
sudo apt autoremove -y
Check the active Java command afterward. If another Java version remains installed, Ubuntu switches to that version; otherwise, the command reports that Java is missing.
java --version
Conclusion
OpenJDK 11 is installed through Ubuntu’s APT packages, with java and, for JDK installs, javac available from the standard OpenJDK path. Keep it for applications pinned to Java 11, and use update-alternatives when newer Java releases sit beside it. For Java build workflows, Apache Maven on Ubuntu pairs naturally with the JDK.
Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>