Java 17 remains the required runtime for many Spring Boot, Jenkins, Gradle, and enterprise application stacks, even when newer Java branches are available. On Linux Mint, install either the Ubuntu-base OpenJDK 17 packages or Eclipse Temurin 17 from Adoptium. The Ubuntu-base packages are the simplest default because they use Mint’s existing APT sources, while Temurin fits teams that standardize on Adoptium builds and do not mind adding a vendor repository.
Linux Mint 22.x uses the Ubuntu 24.04 base, while Linux Mint 21.x uses the Ubuntu 22.04 base. Both series provide OpenJDK 17 packages, but the unversioned default-jdk package is not a pinned Java 17 choice; current Mint 22.x maps it to Java 21, and current Mint 21.x maps it to Java 11. Install openjdk-17-jdk when the project specifically needs Java 17.
Install OpenJDK 17 on Linux Mint
Choose the package source first. Both paths remain APT-managed, but they differ in source ownership, package names, and cleanup steps.
| Method | Source | Best For | Trade-off |
|---|---|---|---|
| Linux Mint APT packages | Ubuntu-base repositories already enabled by Mint | Most desktops, development workstations, and systems that prefer distro-integrated packages | Uses the OpenJDK build shipped through the Ubuntu base |
| Eclipse Temurin 17 | Adoptium APT repository | Teams that standardize on Temurin packages across distributions or deployment targets | Adds a third-party signing key and source file that need separate cleanup |
These commands use
sudofor tasks that need administrator privileges. If your account cannot run sudo yet, add the account to the sudo group with the Linux Mint sudoers setup guide before continuing.
Install OpenJDK 17 from Linux Mint APT
Refresh APT metadata before installing OpenJDK 17 so Linux Mint uses the current package candidate from its enabled sources:
sudo apt update
Check the exact OpenJDK 17 package candidate before installing if you want to confirm the source on a new or customized Mint system:
apt-cache policy openjdk-17-jdk
The Candidate line should show a Java 17 package. The current Mint 22.x candidate comes from the Ubuntu 24.04 base through noble-updates/main or noble-security/main, while the current Mint 21.x candidate comes through jammy-updates/universe or jammy-security/universe.
| Linux Mint Series | Ubuntu Base | Current Candidate Source | OpenJDK 17 Package Page |
|---|---|---|---|
| Linux Mint 22.x | Ubuntu 24.04 LTS | noble-updates/main or noble-security/main | OpenJDK 17 JDK for noble-updates |
| Linux Mint 21.x | Ubuntu 22.04 LTS | jammy-updates/universe or jammy-security/universe | OpenJDK 17 JDK for jammy-updates |
Choose a Linux Mint OpenJDK 17 Package
Use the full JDK for development because it includes the runtime, compiler, and Java tools. Runtime-only packages are useful when the system only runs Java applications and never compiles code.
| Package | Includes | Best For | Trade-off |
|---|---|---|---|
openjdk-17-jdk | Runtime, compiler, and development tools | Most desktops, development workstations, and general use | Installs desktop Java support and developer tools |
openjdk-17-jdk-headless | Compiler and development tools without desktop Java libraries | Build servers, CI runners, containers, and headless systems | No graphical Java application support |
openjdk-17-jre | Runtime only with desktop Java support | Running Java applications on a Mint desktop | No javac compiler |
openjdk-17-jre-headless | Runtime only without desktop Java libraries | Headless services, CI jobs, and minimal runtime systems | No compiler or desktop Java libraries |
Install the full JDK when you are unsure which package to choose:
sudo apt install openjdk-17-jdk
For a headless build system that still needs the compiler, install the headless JDK instead:
sudo apt install openjdk-17-jdk-headless
For runtime-only systems, install one of the JRE packages. Use the desktop JRE for graphical Java applications, or the headless JRE for server and CI workloads:
sudo apt install openjdk-17-jre
sudo apt install openjdk-17-jre-headless
APT also exposes optional OpenJDK 17 documentation, source, demo, debug, and alternative VM packages. Those packages are not required for the normal Java 17 runtime or development workflow.
Install Eclipse Temurin 17 from Adoptium APT
The Adoptium Linux package documentation publishes Temurin DEB packages and notes that Linux Mint should use its Ubuntu base codename. This setup uses the same repository and signing key in a DEB822 source file so the source is easier to audit and remove later.
Install the tools needed to download the key and update HTTPS APT sources:
sudo apt update
sudo apt install curl ca-certificates gpg
Download the Adoptium signing key, convert it to a binary keyring, install it into APT’s shared keyring path, and remove the temporary files:
adoptium_tmp=$(mktemp -d)
curl -fsSLo "$adoptium_tmp/adoptium.asc" https://packages.adoptium.net/artifactory/api/gpg/key/public
gpg --dearmor --yes -o "$adoptium_tmp/adoptium.gpg" "$adoptium_tmp/adoptium.asc"
sudo install -m 0644 "$adoptium_tmp/adoptium.gpg" /usr/share/keyrings/adoptium.gpg
rm -rf "$adoptium_tmp"
On Linux Mint 22.x, add the Adoptium repository with the Ubuntu 24.04 base codename, noble:
printf '%s\n' \
'Types: deb' \
'URIs: https://packages.adoptium.net/artifactory/deb' \
'Suites: noble' \
'Components: main' \
'Signed-By: /usr/share/keyrings/adoptium.gpg' | sudo tee /etc/apt/sources.list.d/adoptium.sources > /dev/null
On Linux Mint 21.x, add the repository with the Ubuntu 22.04 base codename, jammy:
printf '%s\n' \
'Types: deb' \
'URIs: https://packages.adoptium.net/artifactory/deb' \
'Suites: jammy' \
'Components: main' \
'Signed-By: /usr/share/keyrings/adoptium.gpg' | sudo tee /etc/apt/sources.list.d/adoptium.sources > /dev/null
Refresh APT metadata and confirm that Temurin 17 resolves from the Adoptium repository:
sudo apt update
apt-cache policy temurin-17-jdk
Candidate: 17.0.19.0.0+10-1
Install the Temurin 17 JDK for development systems:
sudo apt install temurin-17-jdk
For runtime-only systems, install the Temurin 17 JRE instead:
sudo apt install temurin-17-jre
Adoptium provides temurin-17-jdk and temurin-17-jre packages for this repository path. It does not currently expose separate temurin-17-jdk-headless or temurin-17-jre-headless packages for the Mint 22.x and 21.x Ubuntu bases.
Verify Java 17 on Linux Mint
Check the active Java runtime after installation. Ubuntu-base OpenJDK packages and Temurin packages both report OpenJDK 17, but the update number and vendor lines differ by package source:
java --version
openjdk 17.0.19 2026-04-21
If you installed a JDK package, confirm the compiler is available too:
javac --version
javac 17.0.19
Compile and run a small Java program to prove the JDK works beyond a version check. Run these commands in one terminal session so the temporary directory variable remains available for cleanup:
tmpdir=$(mktemp -d)
cat > "$tmpdir/Hello.java" <<'EOF'
public class Hello {
public static void main(String[] args) {
System.out.println("Linux Mint OpenJDK 17 smoke test");
}
}
EOF
javac "$tmpdir/Hello.java"
java -cp "$tmpdir" Hello
Linux Mint OpenJDK 17 smoke test
Remove the temporary test directory from the same terminal session after the program runs:
if [ -n "${tmpdir:-}" ]; then
rm -rf "$tmpdir"
fi
Manage OpenJDK 17 on Linux Mint
OpenJDK 17 packages installed from Mint’s Ubuntu-base sources and Temurin packages installed from Adoptium both update through APT. Keep the package source clear on systems with multiple Java branches so alternatives, updates, and cleanup stay predictable.
Update Java 17 with APT
Refresh package metadata, then apply available package updates. Review the upgrade list before confirming on systems with important Java workloads:
sudo apt update
sudo apt upgrade
To check whether Ubuntu-base OpenJDK 17 or Temurin 17 packages are installed before a targeted maintenance window, list both package families:
dpkg -l 'openjdk-17*' 'temurin-17*' 2>/dev/null | grep '^ii' || printf 'No installed Java 17 packages found.\n'
Switch the Active Java 17 Commands
Linux Mint uses the Debian alternatives system when multiple Java branches provide the same command. Check the active runtime first:
java --version
For JDK installs, check the compiler branch too:
javac --version
If another Java branch is active, select the Java 17 runtime path from the interactive alternatives menu:
sudo update-alternatives --config java
For JDK installs, configure javac only when the compiler exists but points at another branch:
sudo update-alternatives --config javac
Choose entries under /usr/lib/jvm/java-17-openjdk-amd64/ for the Ubuntu-base packages or /usr/lib/jvm/temurin-17-jdk-amd64/ for Temurin, then rerun the version checks. If the javac alternatives menu reports no alternatives, install openjdk-17-jdk, openjdk-17-jdk-headless, or temurin-17-jdk before configuring the compiler.
Set JAVA_HOME for the Current Terminal
Most Java commands work without a shell-level JAVA_HOME value. Set it only when a build tool, IDE, or application server asks for it. Derive the path from the active java command so the value follows the alternatives selection:
JAVA_HOME=$(dirname "$(dirname "$(readlink -f "$(command -v java)")")")
printf '%s\n' "$JAVA_HOME"
/usr/lib/jvm/java-17-openjdk-amd64
If this command prints another Java tree, switch the active Java alternative before exporting JAVA_HOME. Temurin prints /usr/lib/jvm/temurin-17-jdk-amd64 when its JDK is active.
Export the value for the current terminal session when a tool needs it:
JAVA_HOME=$(dirname "$(dirname "$(readlink -f "$(command -v java)")")")
export JAVA_HOME
export PATH="$JAVA_HOME/bin:$PATH"
For persistent shell startup, update an existing JAVA_HOME line in your shell profile instead of appending duplicate exports. Open a new terminal after changing profile files so login startup reads the new value.
Remove OpenJDK 17 from Linux Mint
Remove only the Java 17 packages you installed. Keep other Java branches, java-common, and application-specific Java data unless you know no remaining package or project needs them.
sudo apt remove openjdk-17-jdk openjdk-17-jdk-headless openjdk-17-jre openjdk-17-jre-headless
For a Temurin installation, remove the Temurin 17 packages:
sudo apt remove temurin-17-jdk temurin-17-jre
If you no longer need the Adoptium repository, remove its source file and refresh APT metadata:
sudo rm -f /etc/apt/sources.list.d/adoptium.sources
sudo apt update
Remove the Adoptium keyring only when no remaining APT source still references it:
sources=()
[ -d /etc/apt/sources.list.d ] && sources+=(/etc/apt/sources.list.d)
[ -f /etc/apt/sources.list ] && sources+=(/etc/apt/sources.list)
if [ "${#sources[@]}" -gt 0 ] && grep -Rqs '/usr/share/keyrings/adoptium.gpg' "${sources[@]}"; then
printf 'Keeping /usr/share/keyrings/adoptium.gpg because another source still references it.\n'
else
sudo rm -f /usr/share/keyrings/adoptium.gpg
fi
If no Temurin packages remain, the Adoptium CA helper package can also be removed:
if ! dpkg-query -W -f='${db:Status-Abbrev}\n' 'temurin-*' 2>/dev/null | grep -q '^ii'; then
sudo apt remove adoptium-ca-certificates
fi
If APT reports that dependencies are no longer required, review the proposed cleanup before accepting it:
sudo apt autoremove
Verify that no Java 17 package remains installed from either method:
dpkg -l 'openjdk-17*' 'temurin-17*' 2>/dev/null | grep '^ii' || printf 'No installed Java 17 packages found.\n'
No installed Java 17 packages found.
Troubleshoot OpenJDK 17 on Linux Mint
Start troubleshooting with package and command-state checks. They separate a missing package candidate from a wrong alternatives selection or a runtime-only install.
APT Cannot Find the OpenJDK 17 Package
If APT cannot locate openjdk-17-jdk, refresh metadata and inspect the candidate:
sudo apt update
apt-cache policy openjdk-17-jdk
A default Mint 22.x or 21.x system should show a non-empty Candidate line. If the candidate is (none), confirm the system is Ubuntu-based Linux Mint and restore the official Ubuntu base repositories from Software Sources before retrying. On Mint 21.x, make sure the Ubuntu Universe component is enabled because the Java 17 package family lives there.
cat /etc/lsb-release
Relevant output should include the Linux Mint identifier:
DISTRIB_ID=LinuxMint
APT Cannot Find the Temurin 17 Package
If APT cannot locate temurin-17-jdk, inspect the Adoptium source file and package candidate:
grep -E '^(URIs|Suites|Components|Signed-By):' /etc/apt/sources.list.d/adoptium.sources
sudo apt update
apt-cache policy temurin-17-jdk
The Suites: value must be noble on Linux Mint 22.x and jammy on Linux Mint 21.x. Do not use the Mint codenames zena or virginia for the Adoptium repository because those suites are not published by Adoptium.
Java Still Shows the Wrong Version
Another Java branch can stay active after installing Java 17, especially on systems used for older projects. Check the runtime version first:
java --version
For JDK installs, check the compiler version too:
javac --version
If java reports the wrong branch, select the Java 17 runtime and retest:
sudo update-alternatives --config java
java --version
If javac is installed but still reports another branch, configure the compiler alternative separately:
sudo update-alternatives --config javac
javac --version
The javac Command Is Missing
The javac command belongs to the JDK packages, not the JRE packages. Check whether a JDK package is installed:
dpkg -l openjdk-17-jdk openjdk-17-jdk-headless temurin-17-jdk 2>/dev/null | grep '^ii'
If the check prints nothing, install the full JDK package that matches your chosen method and rerun the compiler version check:
sudo apt install openjdk-17-jdk
javac --version
sudo apt install temurin-17-jdk
javac --version
JAVA_HOME Points to an Old Java Path
A stale JAVA_HOME value can make build tools use a different Java branch than the terminal command. Compare the current variable with the active command path:
printf '%s\n' "$JAVA_HOME"
readlink -f "$(command -v java)"
If JAVA_HOME does not match the active Java 17 tree, update the current session and then repair the same line in your shell profile:
JAVA_HOME=$(dirname "$(dirname "$(readlink -f "$(command -v java)")")")
export JAVA_HOME
export PATH="$JAVA_HOME/bin:$PATH"
printf '%s\n' "$JAVA_HOME"
Conclusion
OpenJDK 17 is installed on Linux Mint from either the Ubuntu-base package family or Eclipse Temurin’s Adoptium repository, with the runtime, compiler, alternatives state, and first compile test verified. Keep it current through APT, switch alternatives when multiple Java branches coexist, and remove the matching packages and repository files when a project no longer depends on that branch.


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><blockquote>quote</blockquote>