
Install Java on Fedora 44 the right way with a clean, tested process that matches your use case, whether you need a runtime, a full JDK, or a server-ready headless setup. This guide shows the exact commands, explains why each step matters, and helps you avoid the common mistakes that break Java on Fedora 44 setup flows. The Fedora docs confirm that OpenJDK is the preferred choice on Fedora, while Fedora 44’s package set includes Java 25 as the default line and a rolling latest track for users who want newer features.
Java still matters on Fedora because many tools depend on it, including Maven, Gradle, application servers, and build systems. If you are following a Linux server tutorial or trying to configure Java on Fedora 44 for development, you need more than a package name. You need to know which JDK to install, how to verify it, how to switch versions, and how to set JAVA_HOME so your tools work consistently.
Prerequisites
Before you begin, make sure you have the basics ready.
- Operating system: Fedora 44.
- Permissions: A user account with
sudoaccess. - Tools: Terminal access and an active internet connection.
- Optional but useful: A text editor for editing shell profile files.
- Recommended knowledge: Basic command-line comfort and a working idea of JDK versus JRE.
Step 1: Update your system
Refresh package metadata
Run this first:
sudo dnf upgrade --refresh -y
This command updates your package metadata and refreshes your installed packages. The --refresh flag matters because stale metadata can cause install errors or dependency mismatches, especially on a fast-moving distro like Fedora.
The -y flag confirms prompts automatically. That saves time and is especially useful if you are working on a server or using SSH.
Why this step matters
Updating first reduces the chance of broken installs. It also ensures your system is already in a good state before you add Java packages, which is the safest sysadmin habit.
Step 2: Check available Java packages
List Fedora Java options
Use this command:
dnf search openjdk
This shows the Java packages available in Fedora 44 repositories. Fedora Docs recommends checking available versions before installing so you can choose the correct package name.
You may see entries like:
java-25-openjdkjava-25-openjdk-develjava-latest-openjdkjava-latest-openjdk-devel
Check for older versions
If you need a specific older version, verify it first:
dnf -q repoquery --available java-21-openjdk-devel
Fedora 44 does not include java-21-openjdk-devel in the standard repositories, so checking first saves time and prevents a failed install attempt.
Why this step matters
Fedora package names are not the same as Debian or Ubuntu package names. Checking availability first helps you avoid copying a command from another distro and getting stuck.
Step 3: Install OpenJDK 25
Install the recommended JDK
For most users, this is the best choice:
sudo dnf install java-25-openjdk-devel -y
The -devel package installs the full JDK, which includes the compiler and development tools, not just the runtime. Fedora Docs says to install the JDK if you plan to create Java programs, and also notes that the JDK is often useful even when you mainly run Java software.
Install a runtime only
If you only need to run Java apps, use:
sudo dnf install java-25-openjdk -y
If this is a server or minimal install, use the leaner headless package:
sudo dnf install java-25-openjdk-headless -y
The headless package removes GUI-related parts that are not needed on servers. That keeps your install lighter and more focused for a Linux server tutorial use case.
Verify the install
rpm -q java-25-openjdk-devel
java --version
javac --version
Expected output should show Java 25, with both runtime and compiler aligned. LinuxCapable’s Fedora 44 research confirms that Java 25 is the default Fedora 44 line.
Why this step matters
The package name tells Fedora what you need. If you install the runtime only, javac will not exist, and your compile step will fail later. Installing the full JDK now avoids that problem.
Step 4: Install java-latest-openjdk
Install the rolling feature release
If you want the newest feature line Fedora offers, install this package:
sudo dnf install java-latest-openjdk-devel -y
Fedora Docs lists java-latest-openjdk as the latest track, and the Fedora 44 research source notes that it currently maps to OpenJDK 26.
Confirm the package
rpm -q java-latest-openjdk-devel
java --version
You should see the newer major version if Fedora has switched that track forward.
Why this step matters
This package is useful for testing newer Java features. It is not the best choice if you need long-term stability, because it moves with Fedora’s current feature-release line.
Step 5: Install older Java versions
Use Adoptium Temurin for Java 21
If your project needs Java 21, Fedora 44’s standard repo is not enough. Fedora Docs recommends the Adoptium Temurin repository for older Java versions.
Install the repository package:
sudo dnf install adoptium-temurin-java-repository
Enable third-party repos if needed:
sudo fedora-third-party enable
Then search for available Temurin packages:
dnf search temurin
Install Java 21:
sudo dnf install temurin-21-jdk -y
Why this step matters
Some apps and build pipelines still require Java 21, which is an LTS release. If Fedora’s standard repo does not provide it, Temurin gives you a supported alternative without forcing unsupported workarounds.
Step 6: Verify Java works
Check version and paths
Run these commands:
java --version
javac --version
which java
which javac
This confirms the binaries exist and points you to the active executable paths.
Run a small test program
Create a file:
cat > HelloFedora.java <<'EOF'
public class HelloFedora {
public static void main(String[] args) {
System.out.println("Hello from Fedora " + System.getProperty("java.version"));
}
}
EOF
Compile it:
javac HelloFedora.java
Run it:
java HelloFedora
Expected output:
Hello from Fedora 25.0.3
The exact version may differ depending on which Java package you installed.
Why this step matters
A version check tells you Java is installed. A compile-and-run test proves the whole toolchain works. That is the real check sysadmins care about.
Step 7: Switch Java versions
Use alternatives
If you installed more than one JDK, Fedora uses alternatives to choose the default.
List available Java runtimes:
sudo alternatives --config java
Then list compilers too:
sudo alternatives --config javac
Select the same major version for both.
Set a specific version directly
If you already know the path, set it manually:
sudo alternatives --set java /usr/lib/jvm/java-25-openjdk/bin/java
sudo alternatives --set javac /usr/lib/jvm/java-25-openjdk/bin/javac
For the rolling track, the paths will point to java-latest-openjdk.
Why this step matters
Java and javac must match. If they do not, you can run into confusing version mismatch errors. Switching both keeps your Java on Fedora 44 setup stable and predictable.
Step 8: Set JAVA_HOME
Find your active JDK path
Use this command:
dirname "$(dirname "$(readlink -f "$(command -v java)")")"
This prints the active JDK root directory. Tools like Maven and Gradle often use JAVA_HOME, so this path matters for development and CI workflows.
Set it for your user
Add it to your shell profile:
echo 'export JAVA_HOME=/usr/lib/jvm/java-25-openjdk' >> ~/.bashrc
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> ~/.bashrc
source ~/.bashrc
Set it system-wide
If multiple users need the same Java setup, use a profile script:
sudo tee /etc/profile.d/java.sh > /dev/null <<'EOF'
export JAVA_HOME=/usr/lib/jvm/java-25-openjdk
export PATH=$PATH:$JAVA_HOME/bin
EOF
sudo chmod +x /etc/profile.d/java.sh
source /etc/profile.d/java.sh
Why this step matters
Many Java tools do not guess the right runtime automatically. They look at JAVA_HOME, and if it is missing or wrong, builds fail for no obvious reason.
Step 9: Use Oracle JDK if needed
Download and install manually
If your software specifically requires Oracle JDK, download the RPM from Oracle and install it with DNF or RPM.
Example:
sudo dnf install jdk-25_linux-x64_bin.rpm -y
Then verify:
java --version
Fedora Docs notes that Oracle Java SE is not distributed by Fedora itself, so this path is a third-party choice.
Why this step matters
Some enterprise tools are tested against Oracle JDK, not OpenJDK. In those cases, matching the vendor matters more than using the default Fedora package.
Troubleshooting
javac: command not found
This usually means you installed only the runtime package.
Fix it with:
sudo dnf install java-25-openjdk-devel -y
Then check again:
javac --version
No match for argument: java-21-openjdk-devel
That package is not in Fedora 44 standard repositories.
Use Temurin instead:
sudo dnf install adoptium-temurin-java-repository
sudo dnf install temurin-21-jdk -y
Wrong Java version shows up
If java --version does not show the version you expected, another Java install is still active.
Run:
sudo alternatives --config java
sudo alternatives --config javac
Choose the same version in both menus.
JAVA_HOME is not set
Your build tool cannot find the JDK path.
Check the current JDK path with:
dirname "$(dirname "$(readlink -f "$(command -v java)")")"
Then update your shell profile or /etc/profile.d/java.sh.
Install fails after a cache issue
If DNF behaves oddly, refresh metadata again:
sudo dnf upgrade --refresh -y
That often clears up stale package data.
[su_box title=”VPS Manage Service Offer” style=”bubbles” box_color=”#000000″ radius=”10″]If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal![/su_box]