Observations on Installing Java Development Kit on Linux Distros
After recently switching to Linux, I encountered a notable difference in package naming conventions when installing Java Runtime Environment (JRE) and Java Development Kit (JDK). Many popular Linux distributions follow a similar pattern in naming these packages, but it can be a bit confusing at first.
Most distributions, including Fedora and Debian-based systems, provide:
- JRE package under the name
java-xx-openjdk.arch
- JDK package as
java-xx-openjdk-devel.arch
Quick Note on Installing Java JDK vs. JRE
It's easy to accidentally install only the JRE when you're actually looking to set up a full development environment (JDK), as the commands can appear deceptively similar.
For example:
# Installs only the Java Runtime Environment (JRE)
sudo apt install java-21-openjdk # On Debian/Ubuntu
sudo dnf install java-21-openjdk # On Fedora
# Installs the full Java Development Kit (JDK)
sudo apt install java-21-openjdk-devel
sudo dnf install java-21-openjdk-devel
Summary
If you simply run apt install java-21-openjdk
or dnf install java-21-openjdk
, it will only set up the JRE. To ensure you have the full JDK (JVM + JRE), use apt install java-21-openjdk-devel
or dnf install java-21-openjdk-devel
.
Below is a screenshot showing the Fedora package name and description for Java 21:
This should help anyone new to Linux avoid the same confusion when setting up Java.