
In this article, we will address the issue of the error message “Unable to locate package openjdk-15-jdk” that you might encounter while trying to install OpenJDK 15 on Ubuntu 20.04.1 LTS. This error typically occurs because OpenJDK 15 is not available in the default repositories of this Ubuntu version. However, there are alternative methods to install it, which we will explore in detail.
To fix the "Unable to locate package openjdk-15-jdk" error on Ubuntu 20.04, you can either use the OpenJDK PPA or install OpenJDK using Snap. Alternatively, consider upgrading your Ubuntu version to access OpenJDK 15 in the default repositories.
Understanding the Error
When you try to install openjdk-15-jdk
on Ubuntu 20.04.1 LTS using the command sudo apt install openjdk-15-jdk
, you may see the error message “E: Unable to locate package openjdk-15-jdk”. This happens because the package is not available in the default repositories for this Ubuntu version.
Method 1: Using the OpenJDK PPA
The first method to resolve this error is by using the OpenJDK PPA (Personal Package Archive). PPA is a repository that allows developers to upload Ubuntu source packages to be built and published as an APT repository by Launchpad.
Here are the steps to add the OpenJDK PPA repository and update the package list:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt update
In the above commands, sudo
gives you superuser privileges, add-apt-repository
adds the PPA to your list of repositories, and apt update
updates your package list.
Then, install openjdk-15-jdk
using the command:
sudo apt install openjdk-15-jdk
In this command, apt install
installs the specified package.
Method 2: Using Snap
Snap is an alternative installation method on Ubuntu. It is a software deployment and package management system developed by Canonical. Snaps are containerized software packages that are simple to create and install.
You can search for available JDK versions using the command:
snap search openjdk
In the above command, snap search
searches for the specified package in the Snap store.
To install a specific version, such as JDK 18, use the appropriate snap command. For example:
sudo snap install openjdk18
In this command, snap install
installs the specified package from the Snap store.
Consider Upgrading Ubuntu
If you require JDK 15 specifically, you may need to consider upgrading your Ubuntu version to a newer release, such as Ubuntu 20.10 or future releases like 21.04, where OpenJDK 15 is available in the default repositories.
Conclusion
While encountering the “Unable to locate package openjdk-15-jdk” error can be frustrating, there are alternative methods to install OpenJDK 15 on Ubuntu 20.04.1 LTS. You can either use the OpenJDK PPA or Snap. Alternatively, you can consider upgrading your Ubuntu version.
Please note that the OpenJDK PPA is not an official Ubuntu repository, but it provides access to newer OpenJDK versions. Additionally, when using alternative installation methods like Snap, be aware that the default permissions may be restricted. For more details and options, refer to the Snap documentation.
Remember, always ensure that you understand the commands you are running on your system, especially when running commands with sudo
, which gives superuser privileges.
We hope this article has been helpful in resolving the “Unable to locate package openjdk-15-jdk” error on Ubuntu 20.04.
OpenJDK is an open-source implementation of the Java Development Kit (JDK) and the Java Runtime Environment (JRE). It provides a platform for developing and running Java applications.
This error occurs because OpenJDK 15 is not available in the default repositories of Ubuntu 20.04.1 LTS. You need to use alternative installation methods like the OpenJDK PPA or Snap.
A Personal Package Archive (PPA) is a repository that allows developers to upload Ubuntu source packages to be built and published as an APT repository by Launchpad. It provides access to additional software packages that are not available in the default Ubuntu repositories.
Snap is an alternative software deployment and package management system developed by Canonical. It allows you to install and manage software packages in a containerized format. Snaps are self-contained and isolated from the rest of the system, providing enhanced security and easier package management.
Yes, the OpenJDK PPA and Snap can be used for other Ubuntu versions as well. However, make sure to check the compatibility and availability of specific packages for your Ubuntu version.
If you specifically require OpenJDK 15 and it is not available in the default repositories of your Ubuntu version, you may consider upgrading to a newer release where OpenJDK 15 is available. However, upgrading Ubuntu should be done cautiously, considering potential compatibility issues and the impact on other installed software.
When using alternative installation methods, like the OpenJDK PPA or Snap, it is important to note that they are not official Ubuntu repositories. While they provide access to newer versions of OpenJDK, there may be slight differences or limitations compared to the default repositories. Additionally, when using Snap, be aware that default permissions may be restricted, and you may need to adjust them accordingly.
To ensure the security of your system, always download software packages from trusted sources. When using the OpenJDK PPA or Snap, make sure to verify the authenticity of the repositories and packages. Regularly update your system and keep it protected with a reliable antivirus program.