For Ubuntu 22.04, you should be able to simply:
sudo apt install openjdk-21-jdk
It's in the Universe repository, so be sure you have that enabled.
It wasn't available yet when you asked the question, but it is now.
If you add a PPA or other non-Ubuntu version of OpenJDK, remember that it's likely to be incompatible with the (supported Ubuntu repository) Ubuntu package. So keep track of what you install; you might need to remove all of it.
Answer from user535733 on askubuntu.comOracle
docs.oracle.com › en › java › javase › 21 › install › installation-jdk-linux-platforms.html
3 Installation of the JDK on Linux Platforms
July 15, 2025 - Download the key file from https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9 using the following command: wget https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9 ... Note:Public key installation needs to be done only once. The key installation is persistent across reboots.
Videos
05:19
How to Install Java on Ubuntu and set JAVA_HOME (2025 UPDATE) #JDK ...
01:57
How to Install JAVA/JDK in Linux Using Terminal (2024) - YouTube
01:46
How to Install JDK 21 on Ubuntu 22.04 (2024) - YouTube
13:11
How To Install Latest Java JDK On Ubuntu, Debian, Linux mint (2026) ...
02:37
How to Install Java in Ubuntu 22.04 Using Terminal (2024 Update) ...
06:14
How to download install and configure Java jdk 21 on Kali Linux ...
Red Hat
docs.redhat.com › en › documentation › red_hat_build_of_openjdk › 21 › html-single › installing_and_using_red_hat_build_of_openjdk_21_on_rhel › index
Installing and using Red Hat build of OpenJDK 21 on RHEL | Red Hat build of OpenJDK | 21 | Red Hat Documentation
Create a directory to where you want to download the archive file, and then navigate to that directory on your command-line interface (CLI). For example: ... Navigate to the Software Downloads page on the Red Hat Customer Portal. Select the latest version of Red Hat build of OpenJDK 21 from ...
Fabric Documentation
docs.fabricmc.net › players › installing-java › linux
Installing Java on Linux | Fabric Documentation
April 2, 2026 - A step-by-step guide on how to install Java on Linux.
UbuntuHandbook
ubuntuhandbook.org › home › howtos › install oracle java jdk 21, 25, or 26 in ubuntu 24.04 | 22.04 | 20.04
Install Oracle Java JDK 21, 25, or 26 in Ubuntu 24.04 | 22.04 | 20.04 | UbuntuHandbook
sudo apt install ~/Downloads/jdk-21_linux-x64_bin.deb · Here replace 21 in command if you downloaded JDK 25 or 26. Or, just drag and drop the .deb package from your downloads folder into terminal to auto-insert path to that file. The .deb package include a post-install script that automatically ...
Develop n Solve
developnsolve.com › linux › how-to-install-java-21-linux
How to Install Java 21 on Linux
Supported Linux distribution: Ensure ... with Java 21 packages. Root or sudo access: Administrative privileges are required to install software and configure environment variables on your system. Basic terminal knowledge: Familiarity with Linux command line helps in downloading, ...
Java With Us
javawithus.com › home › faq › how to install java on linux (all distros)
How to Install Java on Linux (All Distros) | Java With Us
April 21, 2026 - Linux has the easiest Java install path of any OS — every major distribution ships OpenJDK in its standard package manager. One command gets you a working JDK. sudo apt update sudo apt install openjdk-21-jdk java -version
XDA Developers
xda-developers.com › home › java › how to install java on ubuntu
How to install Java on Ubuntu
March 1, 2024 - You can choose Java 17 or Java 21. When the download is complete, double-click to launch it. Click the green Install button. Enter your password. Once the installation is complete, you'll be able to see Oracle Java in your list of applications. If you want, you can also install it manually without going through the web browser by typing out the following commands, pressing Enter in between each line...
Red Hat
docs.redhat.com › en › documentation › red_hat_build_of_openjdk › 21 › html › installing_and_using_red_hat_build_of_openjdk_21_on_rhel › installing-openjdk-on-rhel_openjdk
Chapter 2. Installing Red Hat build of OpenJDK 21 on Red Hat Enterprise Linux | Installing and using Red Hat build of OpenJDK 21 on RHEL | Red Hat build of OpenJDK | 21 | Red Hat Documentation
Create a directory to where you want to download the archive file, and then navigate to that directory on your command-line interface (CLI). For example: ... Navigate to the Software Downloads page on the Red Hat Customer Portal. Select the latest version of Red Hat build of OpenJDK 21 from ...
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › How-to-install-Java-21
How to download and install Java 21 on Windows
Extract the Java 21 zip file to a sensible location on your filesystem. Configure the JAVA_HOME environment variable. Add the JDK’s \bin directory to the PATH of your OS. Issue a java -version command to ensure the Java 21 install succeeded.
Oracle
java.com › en › download › help › linux_install.html
How do I download and install 32-bit Java for Linux?
Instructions to download and install the Java Runtime Environment (JRE) for 32-bit Linux
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-java-with-apt-on-ubuntu-22-04
How to Install Java with Apt on Ubuntu (JRE & JDK) | DigitalOcean
February 2, 2026 - 11.0.13_linux-x64_bin.tar.gz /var/cache/oracle-jdk11-installer-local/ ... The installer will first ask you to accept the Oracle license agreement. Accept the agreement, then the installer will extract the Java package and install it. Now you’ll look at how to select the version of Java you want to use. You can have multiple Java installations on one server. You can configure which version is used by default on the command line by using the update-alternatives command.