Java 25 is the current LTS branch for applications that need a long-lived runtime with finalized scoped values, module import declarations, and compact source files. You can install OpenJDK 25 on Debian 13 directly from Debian’s default repositories, while Debian 12 and Debian 11 need Eclipse Temurin packages from Adoptium.
The OpenJDK JDK 25 project lists JDK 25 as a general-availability release and notes that most vendors treat it as long-term support. Vendor support windows still vary, so the Temurin sections below follow Adoptium’s current package and support policy rather than assuming one universal Java 25 end date.
Install OpenJDK 25 on Debian
Two installation methods are available, each with different version scope and update characteristics:
| Method | Source | Release Scope | Updates | Best Fit |
|---|---|---|---|---|
| Debian APT | Debian package sources | Debian 13 (trixie) | Through normal Debian security and package updates | Debian 13 systems that prefer distro-packaged OpenJDK without an external repository |
| Eclipse Temurin | Adoptium Linux packages | Debian 13 (trixie), Debian 12 (bookworm), and Debian 11 (bullseye) | Through the Adoptium APT repository | Debian 12 and 11 systems, or Debian 13 systems that want Adoptium’s TCK-tested Temurin build |
Use Debian APT on Debian 13 (trixie) unless you specifically need the Temurin distribution. Debian 12 (bookworm) and Debian 11 (bullseye) do not carry openjdk-25-jdk, so use the Adoptium repository on those releases to keep Java 25 package-managed.
The default-jdk package does not install Java 25 on any of these Debian releases. Debian 13 resolves it to OpenJDK 21, Debian 12 resolves it to OpenJDK 17, and Debian 11 resolves it to OpenJDK 11, so install the explicit OpenJDK 25 or Temurin 25 package when your application requires Java 25.
OpenJDK is the upstream Java project. Eclipse Temurin is an OpenJDK distribution built by Adoptium, Java SE TCK-tested, and packaged for Debian through Adoptium’s APT repository.
Refresh your package index before installing so APT uses current package metadata:
sudo apt update
Commands that install packages or write APT source files need root privileges. If your account cannot use
sudo, run the commands from a root shell or follow how to add a user to sudoers on Debian first.
Install OpenJDK 25 via Debian APT on Debian 13
Debian 13 (trixie) includes OpenJDK 25 in its default repositories alongside OpenJDK 21, which remains the default-jdk dependency. No external repository is required. List the available OpenJDK 25 packages first:
apt-cache search openjdk-25
Relevant Debian 13 package results include:
openjdk-25-jdk - OpenJDK Development Kit (JDK) openjdk-25-jdk-headless - OpenJDK Development Kit (JDK) (headless) openjdk-25-jre - OpenJDK Java runtime, using Hotspot JIT openjdk-25-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless) openjdk-25-source - OpenJDK Development Kit (JDK) source files openjdk-25-doc - OpenJDK Development Kit (JDK) documentation openjdk-25-demo - Java runtime based on OpenJDK (demos and examples) openjdk-25-dbg - Java runtime based on OpenJDK (debugging symbols)
The “headless” variants exclude graphical libraries and are designed for servers or CI/CD systems without a display. Choose headless packages if you are building Docker containers on Debian or running on a server without a GUI.
Install OpenJDK 25 JRE or JDK
The Java Runtime Environment (JRE) is sufficient when you only run Java applications and do not compile source code:
sudo apt install openjdk-25-jre
For development work, compiling source code, or using build tools like Apache Maven on Debian, install the full Java Development Kit instead. The JDK includes the JRE plus development utilities such as the Java compiler, debugger, and documentation tools:
sudo apt install openjdk-25-jdk
Choose the JDK if you expect to compile source code or use Java build tools. Choose the JRE for runtime-only systems where the compiler and other development utilities are unnecessary.
For server environments without a graphical display, use the headless variants instead:
sudo apt install openjdk-25-jdk-headless
Verify the OpenJDK 25 Installation
Confirm Java is accessible by checking the installed version:
java --version
The version string identifies this as the Debian-packaged build:
openjdk 25.0.3 2026-04-21 OpenJDK Runtime Environment (build 25.0.3+9-2-deb13u1-Debian) OpenJDK 64-Bit Server VM (build 25.0.3+9-2-deb13u1-Debian, mixed mode, sharing)
If you installed the JDK, also verify that the Java compiler is available:
javac --version
javac 25.0.3
Update Debian APT OpenJDK 25 Packages
Debian-packaged OpenJDK 25 receives updates through the normal Debian repositories. Refresh package metadata and upgrade the installed OpenJDK 25 package variant with:
sudo apt update
sudo apt install --only-upgrade openjdk-25-jdk openjdk-25-jre openjdk-25-jdk-headless openjdk-25-jre-headless
APT skips any package from that list that is not installed, so the same command works whether you chose the JDK, JRE, or a headless variant.
Install Eclipse Temurin 25 from the Adoptium APT Repository
Eclipse Temurin builds from the Adoptium project work on Debian 13 (trixie), Debian 12 (bookworm), and Debian 11 (bullseye). This method adds the Adoptium APT repository so future Java 25 updates arrive through your regular package workflow.
Adoptium maintains and signs this vendor repository. It is separate from Debian’s package sources, so APT verifies its metadata and packages with a dedicated Adoptium key and receives Temurin updates from Adoptium.
Install Prerequisites for the Adoptium Repository
The repository setup needs ca-certificates for HTTPS validation, curl to download the signing key, and gpg to convert that key into the binary format APT expects. Install them before creating the source file:
sudo apt install ca-certificates curl gpg
Import the Adoptium GPG Key
Download the Adoptium repository signing key, verify its full fingerprint, and install the verified key in APT’s directory for locally managed keyrings. The fingerprint check stops the setup before APT trusts the source if the downloaded key does not match Adoptium’s current key:
ADOPTIUM_FINGERPRINT='3B04D753C9050D9A5D343F39843C48A565F8F04B'
key_workdir="$(mktemp -d)"
gpg_home="$key_workdir/gnupg"
mkdir -m 0700 "$gpg_home"
curl -fsSLo "$key_workdir/adoptium.asc" \
https://packages.adoptium.net/artifactory/api/gpg/key/public
fetched_fingerprint="$(gpg --homedir "$gpg_home" --quiet --show-keys \
--with-colons --fingerprint "$key_workdir/adoptium.asc" | \
awk -F: '$1 == "fpr" {print toupper($10); exit}')"
if [ "$fetched_fingerprint" = "$ADOPTIUM_FINGERPRINT" ]; then
gpg --homedir "$gpg_home" --dearmor --yes \
-o "$key_workdir/adoptium.gpg" "$key_workdir/adoptium.asc" &&
sudo install -m 0755 -d /etc/apt/keyrings &&
sudo install -m 0644 "$key_workdir/adoptium.gpg" \
/etc/apt/keyrings/adoptium.gpg
result=$?
if [ "$result" -eq 0 ]; then
printf 'Adoptium key fingerprint verified: %s\n' "$fetched_fingerprint"
fi
else
printf 'Adoptium key fingerprint mismatch; repository not added.\n' >&2
result=1
fi
rm -rf "$key_workdir"
[ "$result" -eq 0 ]
The temporary GPG home keeps repository-key processing out of your personal keyring. The -fsSLo flags make curl fail on HTTP errors, follow redirects, and save the key to the named temporary file. See the curl command guide for more download options. After the fingerprint matches, gpg --dearmor --yes creates a binary keyring, and install places it at /etc/apt/keyrings/adoptium.gpg with permissions that APT can read. A successful run prints the verified fingerprint; the final status check prevents a failed download, comparison, conversion, or install from appearing successful.
Add the Adoptium Repository
Create the repository configuration file using DEB822 format. The command detects your Debian codename and CPU architecture from the local system:
. /etc/os-release
printf '%s\n' \
'Types: deb' \
'URIs: https://packages.adoptium.net/artifactory/deb' \
"Suites: $VERSION_CODENAME" \
'Components: main' \
"Architectures: $(dpkg --print-architecture)" \
'Signed-By: /etc/apt/keyrings/adoptium.gpg' | sudo tee /etc/apt/sources.list.d/adoptium.sources > /dev/null
The $VERSION_CODENAME value comes from /etc/os-release, so the same block writes trixie, bookworm, or bullseye as needed. The tee command writes the root-owned source file while keeping the shell redirection outside the privileged part.
Refresh the package index to include the newly added repository:
sudo apt update
Confirm APT can see the Temurin 25 package from the new source:
apt-cache policy temurin-25-jdk
Relevant lines on Debian 12 Bookworm include the current Temurin 25 candidate and the Adoptium package source:
temurin-25-jdk:
Installed: (none)
Candidate: 25.0.3.0.0+9-1
Version table:
25.0.3.0.0+9-1 500
500 https://packages.adoptium.net/artifactory/deb bookworm/main amd64 Packages
Debian 13 and Debian 11 show the same candidate version with trixie or bullseye in the source line.
Install Temurin 25
Install the Eclipse Temurin 25 JDK package from the Adoptium repository:
sudo apt install temurin-25-jdk
Adoptium also provides
temurin-25-jreif you only need the runtime environment without development tools.
Verify the Temurin Installation
Check the installed version to confirm Temurin is active:
java --version
The output shows the Temurin build identifier with the “LTS” designation:
openjdk 25.0.3 2026-04-21 LTS OpenJDK Runtime Environment Temurin-25.0.3+9 (build 25.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-25.0.3+9 (build 25.0.3+9-LTS, mixed mode, sharing)
Update Temurin to the Latest Version
Temurin receives updates through the Adoptium APT repository. To check for and install the latest version:
sudo apt update
sudo apt install --only-upgrade temurin-25-jdk temurin-25-jre
APT upgrades whichever Temurin 25 package is installed and skips the other if it is absent. If Temurin 25 is already current, APT exits without changes.
Manage Multiple Java Versions on Debian
Development environments often require multiple Java versions for different projects. Debian’s update-alternatives system manages symlinks in /usr/bin/, allowing you to switch between installed versions without modifying PATH variables or manually creating symlinks.
Switch the Default Java Runtime
To view all installed Java versions and interactively select the system default:
sudo update-alternatives --config java
The command displays a numbered list of available Java installations. If multiple versions are installed, the output looks similar to:
There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/java-25-openjdk-amd64/bin/java 2511 auto mode 1 /usr/lib/jvm/java-21-openjdk-amd64/bin/java 2111 manual mode 2 /usr/lib/jvm/java-25-openjdk-amd64/bin/java 2511 manual mode Press <enter> to keep the current choice[*], or type selection number:
Type the number corresponding to your preferred Java version and press Enter. The asterisk marks the currently active selection. Confirm the change by running java --version again.
Switch the Default Java Compiler
When using multiple JDK versions, also switch the Java compiler to match the runtime. Compiling with one Java version while running on another can cause bytecode compatibility issues:
sudo update-alternatives --config javac
Select the same version number you chose for the runtime. Both commands return immediately to the shell prompt after making your selection.
Configure the JAVA_HOME Environment Variable
Build tools, IDEs, and application servers frequently require the JAVA_HOME environment variable to locate your Java installation. To identify the installation path of your currently active Java version:
dirname "$(dirname "$(readlink -f "$(command -v java)")")"
With the Debian APT installation of OpenJDK 25 active on a 64-bit system, this returns:
/usr/lib/jvm/java-25-openjdk-amd64
If you installed Eclipse Temurin instead, the path is
/usr/lib/jvm/temurin-25-jdk-amd64. On ARM64 systems (such as Raspberry Pi or AWS Graviton instances), the directory name ends with-arm64instead of-amd64. Detect the path from the activejavacommand so it matches your architecture and installation method.
Set JAVA_HOME for the current shell and save one current export in ~/.bashrc for future Bash sessions. The sed command removes stale or duplicate exports before the replacement is added:
JAVA_HOME_PATH="$(dirname "$(dirname "$(readlink -f "$(command -v java)")")")"
touch "$HOME/.bashrc"
sed -i '/^[[:space:]]*export[[:space:]]\+JAVA_HOME=/d' "$HOME/.bashrc"
printf '\nexport JAVA_HOME=%s\n' "$JAVA_HOME_PATH" >> "$HOME/.bashrc"
export JAVA_HOME="$JAVA_HOME_PATH"
Verify the variable is configured correctly:
printf '%s\n' "$JAVA_HOME"
/usr/lib/jvm/java-25-openjdk-amd64
Test OpenJDK 25 with a Sample Java Program on Debian
Testing the full compile-and-run cycle catches issues that version checks alone miss.
Create a Test Program
Create a compact Java source file that uses Java 25’s module import declarations and instance main method syntax:
cat <<'EOF' > Hello.java
import module java.base;
void main() {
var javaVersion = System.getProperty("java.version");
var osName = System.getProperty("os.name");
System.out.println("Hello from OpenJDK 25!");
System.out.println("Running Java " + javaVersion + " on " + osName);
System.out.println("Using compact source file syntax - no class declaration needed!");
}
EOF
Compile and Run the Program
Compile the source file into Java bytecode:
javac Hello.java
Successful compilation produces no output and creates a Hello.class file in the current directory. If the compilation fails, verify that OpenJDK 25 is the active version using javac --version.
Execute the compiled program:
java Hello
A successful run prints:
Hello from OpenJDK 25! Running Java 25.0.3 on Linux Using compact source file syntax - no class declaration needed!
Compare OpenJDK LTS Releases for Debian
Picking the right Java version affects long-term maintenance and access to language features. These LTS notes use Adoptium’s current Temurin support roadmap, so treat the dates as vendor-specific availability windows rather than universal OpenJDK end dates.
| Java Version | Temurin Availability | Choose It When | Trade-offs |
|---|---|---|---|
| OpenJDK 8 | At least December 2030 | Legacy applications, older frameworks like Spring 4.x, or vendor-certified deployments requiring Java 8 | Missing modern language features such as records, pattern matching, and virtual threads |
| OpenJDK 11 | At least October 2027 | Legacy enterprise applications, older frameworks requiring Java 11 as a minimum, or vendor-certified deployments | Missing newer platform features such as records, pattern matching, and virtual threads |
| OpenJDK 17 | At least October 2027 | Spring Boot 3.x, Jakarta EE 10+, or workloads benefiting from records and sealed classes | Lacks virtual threads and scoped values from newer releases |
| OpenJDK 21 | At least December 2029 | High-concurrency applications using virtual threads or teams that need the previous LTS baseline | Scoped values were still preview features in Java 21, and Java 25 adds newer finalized APIs |
| OpenJDK 25 | At least September 2031 | New projects, applications requiring finalized scoped values, key derivation APIs, or the latest stable LTS features | Newest LTS release; verify framework compatibility before production migration |
OpenJDK 25 suits new projects, applications that benefit from finalized scoped values for thread-safe data sharing, and teams wanting access to the latest stable language improvements. If your project depends on frameworks that have not yet certified Java 25 support, consider OpenJDK 21 on Debian as a stable alternative until your stack is ready.
Troubleshoot Common OpenJDK 25 Issues on Debian
OpenJDK 25 Package Not Found on Debian 12 or Older
If apt install openjdk-25-jdk fails with “Unable to locate package,” your Debian version does not include OpenJDK 25 in its default repositories. Debian 12 Bookworm ships OpenJDK 17 on Debian as its newest available default-archive version, and Debian 11 Bullseye tops out at OpenJDK 17 as well. The package is not available through Debian’s backports repository for either release.
E: Unable to locate package openjdk-25-jdk
Confirm your Debian version to verify this is the cause:
grep -E "^(PRETTY_NAME|VERSION_CODENAME)" /etc/os-release
On Debian 12 Bookworm, the output looks like:
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" VERSION_CODENAME=bookworm
If the output shows bookworm or bullseye, use the Eclipse Temurin method from the Adoptium repository instead. Temurin provides OpenJDK 25 packages for Debian 13, Debian 12, and Debian 11.
Temurin 25 Package Not Found After Adding Adoptium
If sudo apt install temurin-25-jdk returns “Unable to locate package,” APT has not ingested the Adoptium source or the source file contains the wrong release codename:
E: Unable to locate package temurin-25-jdk
Refresh the package index and recheck the package candidate:
sudo apt update
apt-cache policy temurin-25-jdk
If no candidate appears, inspect the saved source file:
grep -E "^(URIs|Suites|Components|Architectures|Signed-By):" /etc/apt/sources.list.d/adoptium.sources
The Suites: line must match your Debian codename, such as trixie, bookworm, or bullseye. If the file is missing or uses the wrong codename, rerun the Adoptium source creation step and then repeat sudo apt update.
Wrong Java Version Active After Installation
If java --version reports a different version than expected, multiple Java versions exist on your system with a higher priority assigned to another version. List available alternatives to fix this:
sudo update-alternatives --config java
Select the entry corresponding to OpenJDK 25 and confirm your selection. Also update the compiler using sudo update-alternatives --config javac to maintain consistency between runtime and compiler.
Build Tool Reports Invalid Source Release 25
Build errors such as “invalid source release: 25” or “release 25 is not found in the system” usually mean your compiler or build tool is still using an older Java release while the project requests Java 25:
error: invalid source release: 25
Check the compiler and JAVA_HOME path:
javac --version
printf '%s\n' "$JAVA_HOME"
A Debian APT install should report Java 25 and the OpenJDK 25 path:
javac 25.0.3 /usr/lib/jvm/java-25-openjdk-amd64
If javac reports Java 21, 17, or 11, switch both java and javac with update-alternatives. If JAVA_HOME points at an older directory, update the export and reload your shell before rerunning Maven, Gradle, or another build tool.
JAVA_HOME Not Recognized by Build Tools
Build tools failing with “JAVA_HOME is not defined” or pointing to an incorrect path means the environment variable needs configuration. Identify the correct path for your installation:
dirname "$(dirname "$(readlink -f "$(command -v java)")")"
Remove stale or duplicate JAVA_HOME exports, save the detected path, and set the variable in the current shell:
JAVA_HOME_PATH="$(dirname "$(dirname "$(readlink -f "$(command -v java)")")")"
touch "$HOME/.bashrc"
sed -i '/^[[:space:]]*export[[:space:]]\+JAVA_HOME=/d' "$HOME/.bashrc"
printf '\nexport JAVA_HOME=%s\n' "$JAVA_HOME_PATH" >> "$HOME/.bashrc"
export JAVA_HOME="$JAVA_HOME_PATH"
Command substitution detects the active Java path regardless of whether you installed Debian OpenJDK or Temurin. Removing old exports first keeps the profile unambiguous after a Java version switch. Verify the variable with printf '%s\n' "$JAVA_HOME".
Bytecode Version Mismatch Errors
Errors mentioning “unsupported major.minor version” or “class file version 69.0” occur when code compiled with Java 25 runs on an older JRE. Verify your compiler and runtime versions match:
java --version
javac --version
Both commands should report Java 25. If they differ, align them using sudo update-alternatives --config for both java and javac.
Remove OpenJDK 25 from Debian
If you no longer need OpenJDK 25, use the appropriate removal commands based on your installation method.
Remove Debian APT OpenJDK
Remove the OpenJDK 25 packages installed from Debian’s default repositories:
sudo apt remove openjdk-25-jdk openjdk-25-jre openjdk-25-jdk-headless openjdk-25-jre-headless
Remove Eclipse Temurin
Remove Eclipse Temurin 25 installed from the Adoptium repository:
sudo apt remove temurin-25-jdk temurin-25-jre
After either package removal path, preview unused dependencies before deleting them:
sudo apt autoremove --dry-run
APT can include packages that were already marked as automatic before you installed Java, including older kernels or shared desktop libraries. Review every proposed removal. If any entry is unrelated to Java or you are unsure why it is listed, skip this step and leave those packages installed.
Run the real cleanup only when you recognize every package in the preview and no longer need any of them:
sudo apt autoremove
Optionally remove the Adoptium repository and GPG key if you no longer need any Temurin packages:
sudo rm -f /etc/apt/sources.list.d/adoptium.sources
sudo rm -f /etc/apt/keyrings/adoptium.gpg
sudo apt update
Confirm the source and key are gone, then check that Adoptium no longer provides a Temurin 25 candidate:
test ! -e /etc/apt/sources.list.d/adoptium.sources && echo "Adoptium source removed"
test ! -e /etc/apt/keyrings/adoptium.gpg && echo "Adoptium key removed"
apt-cache policy temurin-25-jdk
The first two checks print confirmation messages. After a complete repository cleanup, apt-cache policy shows no Temurin 25 candidate unless another configured source provides the package.
Verify OpenJDK 25 Removal
After removal, confirm no OpenJDK 25 package remains installed:
dpkg -l openjdk-25-jdk openjdk-25-jre openjdk-25-jdk-headless openjdk-25-jre-headless temurin-25-jdk temurin-25-jre 2>/dev/null | grep '^ii' || echo "No OpenJDK 25 package is installed"
A clean package check prints:
No OpenJDK 25 package is installed
If other Java versions remain, java --version shows whichever runtime is now active.
If you configured
JAVA_HOMEin your~/.bashrcfile, remember to update or remove that export line after uninstalling OpenJDK 25. Applications relying onJAVA_HOMEwill fail if the path points to a removed installation.
Conclusion
Debian 13 can run the distro-packaged OpenJDK 25 build, while Debian 12 and 11 can keep Java 25 package-managed through Eclipse Temurin. After the version check and sample compilation succeed, use update-alternatives to switch installed Java branches and keep JAVA_HOME aligned with the active runtime. Set up Apache Maven on Debian for dependency management next, or add Git on Debian for version control alongside your Java projects.


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><a href="https://example.com">link</a><blockquote>quote</blockquote>