You probably run more Java than you think. A Jenkins box, a Minecraft server, a Tomcat container, a JetBrains IDE with its own bundled runtime. When a bug like Java4Shell lands, the hard part isn't patching. It's knowing every place a JVM lives on the machine.
Phoronix's report headlines Java4Shell as an OpenJDK vulnerability that can lead to remote code execution. The page does not give affected versions, a CVE ID, exploit conditions or fixed builds, so this guide doesn't state any of those either. Get them from the official OpenJDK advisory list at https://openjdk.org/groups/vulnerability/advisories/ and from your distro's tracker, then plug them into the steps below.
The commands here are standard package-manager and shell tools, but none of them were run or tested for this guide. Every output block is labeled illustrative, so expect your package names and version strings to differ. Run them with sudo where shown, and read any command before running it on a production host.
Step 1: Collect the facts from the advisory
Before touching a server, write down four things from the official sources:
- which OpenJDK release lines are affected
- the fixed version string for each line
- the CVE ID, if one is assigned
- whether any workaround is recommended before patching
Then check your distro's own advisory. Distros often backport fixes without changing the upstream version number, so an Ubuntu or RHEL package can carry the fix while still reporting an older-looking version. These are the trackers to check:
Debian: https://security-tracker.debian.org/tracker/
Ubuntu: https://ubuntu.com/security/cves
Red Hat and derivatives: https://access.redhat.com/security/security-updates/
Arch: https://security.archlinux.org/
The rule: compare distro packages against the distro advisory, and compare everything else (tarballs, SDKMAN, bundled JREs) against the upstream or vendor advisory.
Step 2: List package-managed runtimes
Start with what your package manager knows. Package names vary by release, so list first and update later.
Debian and Ubuntu
dpkg -l | grep -Ei 'openjdk|temurin|jdk|jre'
update-alternatives --list java
update-alternatives --display java
Illustrative output of the first command:
ii openjdk-17-jre-headless:amd64 17.0.x+y-1~22.04 amd64 OpenJDK Java runtime, using Hotspot JIT (headless)
ii openjdk-21-jdk:amd64 21.0.x+y-1~22.04 amd64 OpenJDK Development Kit (JDK)
Fedora, RHEL and derivatives
rpm -qa | grep -Ei 'openjdk|temurin'
dnf list installed 'java-*-openjdk*'
alternatives --display java
Illustrative output:
java-17-openjdk-headless-1:17.0.x.y-1.fc40.x86_64
java-21-openjdk-devel-1:21.0.x.y-1.fc40.x86_64
Arch Linux
pacman -Qs openjdk
archlinux-java status
Illustrative output of the second command:
Available Java environments:
java-17-openjdk
java-21-openjdk (default)
Note that update-alternatives, alternatives and archlinux-java show the default. They don't show every installed runtime, and they don't necessarily show what your services use. That's why the next steps matter.
Step 3: Hunt for runtimes the package manager does not own
This is where most missed installs hide. Search the filesystem for the JVM library and for java launchers.
sudo find / -xdev -type f -name libjvm.so 2>/dev/null
sudo find / -xdev -type f -name java -perm -u+x 2>/dev/null
The first command is more reliable, since it also catches bundled JREs that ship the library under an app directory. -xdev keeps find on one filesystem, so repeat it for any separately mounted /opt, /srv or /home volumes. We cover related ground in wine on arm64 avx support: will your windows apps run? explained.
To print the version of every launcher found:
for j in $(sudo find / -xdev -type f -name java -perm -u+x 2>/dev/null); do echo == $j; $j -version 2>&1 | head -n 1; done
Illustrative output:
== /usr/lib/jvm/java-17-openjdk-amd64/bin/java
openjdk version "17.0.x" 2026-xx-xx
== /opt/jenkins/jre/bin/java
openjdk version "11.0.x" 20xx-xx-xx
== /home/mc/.sdkman/candidates/java/21.0.x-tem/bin/java
openjdk version "21.0.x" 2026-xx-xx
That middle line is the classic surprise: an application with its own JRE that no apt, dnf or pacman command will ever update.
SDKMAN, tarballs, Flatpak, snaps and containers
SDKMAN installs live under each user's home, usually ~/.sdkman/candidates/java/. Run sdk current java and ls ~/.sdkman/candidates/java/ as each user that has it, including service accounts. Manual tarballs tend to sit in /opt, /usr/local or a home directory, which the find commands above cover.
Sandboxed and containerized Java needs separate checks:
flatpak list | grep -Ei 'java|jdk'
snap list | grep -Ei 'java|jdk'
docker ps --format '{{.Names}} {{.Image}}'
A container image carries its own JDK, so patching the host does nothing for it. Rebuild or pull a fixed image and recreate the container.
Step 4: See what is actually running
Installed doesn't mean in use. Find the binary behind each running JVM:
ps -eo pid,user,args | grep [j]ava
for pid in $(pgrep -x java); do echo $pid $(readlink -f /proc/$pid/exe); done
Illustrative output:
2143 /opt/jenkins/jre/bin/java
3310 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
For a service you suspect, systemctl cat servicename shows whether the unit hardcodes a path, sets JAVA_HOME, or relies on whatever java resolves to. That tells you which update channel actually reaches it.
Audit checklist
Work through this in order for each host:
- Note the confirmed fixed versions from the OpenJDK advisory and your distro tracker.
- List package-managed JDKs and JREs with the distro commands above.
- Search the filesystem for
libjvm.soandjavabinaries outside /usr/lib/jvm. - Check SDKMAN directories for every user, plus Flatpak, snap and Docker.
- Map each running JVM to its binary through /proc.
- Mark each runtime as fixed, unfixed or unknown, and record who owns the update.
Step 5: Decide which runtimes are affected
For package-managed JDKs, match the full package version against the distro advisory. On Debian and Ubuntu, apt changelog openjdk-17-jre-headless shows the changelog. On RPM systems, rpm -q --changelog java-17-openjdk-headless | head -n 40 does the same. Once you have the CVE ID from the advisory, search those changelogs for it. A changelog entry naming the CVE is better evidence than a version number.
For everything else, read the exact build string:
/path/to/java -XshowSettings:properties -version 2>&1 | grep -E 'java.runtime.version|java.vendor'
Compare java.runtime.version to the fixed version the advisory lists for that release line. Temurin, Corretto, Zulu and others each publish their own notices, so if the OpenJDK advisory doesn't cover your vendor's build, check that vendor. Anything you can't match goes in the unknown pile, and unknown should be treated as unfixed. See check which radeon driver your old gpu uses on linux: the details for additional background.
Step 6: Update through the right channel
Note the current version first so you have a rollback target: apt-cache policy PKG, dnf list installed PKG or pacman -Q PKG.
Debian and Ubuntu
sudo apt update
apt list --upgradable 2>/dev/null | grep -Ei 'jdk|jre'
sudo apt install --only-upgrade openjdk-17-jre-headless
Substitute the package names from Step 2.
Fedora, RHEL and derivatives
sudo dnf upgrade --refresh 'java-*-openjdk*'
Arch Linux
sudo pacman -Syu
On Arch, run the full upgrade rather than pacman -Sy plus a single package. Partial upgrades are unsupported and can break unrelated software.
SDKMAN, tarballs and bundled JREs
With SDKMAN, run sdk list java, then sdk install java IDENTIFIER for the fixed build and sdk default java IDENTIFIER.
For a tarball, download the fixed build from the vendor and verify its checksum. Unpack it next to the old directory instead of over it, then switch a symlink or JAVA_HOME.
Bundled JREs need an update from that application's vendor, or a supported setting that points the app at a system JDK. If neither exists, record the exposure and consider limiting network access to that service until a fix ships.
Restart what still uses the old runtime
A running JVM keeps the old code mapped in memory, so the package upgrade alone doesn't protect it. List processes still holding deleted library files:
Also read: related topic: opensil vs agesa: what changes for coreboot users now
sudo grep -l 'libjvm.so (deleted)' /proc/[0-9]*/maps 2>/dev/null
Each PID listed needs a restart. Restart by service name, for example sudo systemctl restart jenkins. For Minecraft servers, announce the restart first so you don't corrupt a world mid-save. On Debian and Ubuntu, sudo needrestart can automate part of this, and on RHEL-family systems so can sudo dnf needs-restarting.
Step 7: Verify the fix
Repeat Steps 3 and 4. Every running JVM should resolve to a binary whose version matches the advisory, and the (deleted) grep should return nothing.
java -version
sudo systemctl status jenkins
sudo journalctl -u jenkins -n 50 --no-pager
Check the application too, not just the process. Log in, load a page, run a job. A service can start cleanly and still fail on its first real request.
Step 8: Roll back if something breaks
Rolling back reintroduces the vulnerability. Treat it as a short-term step while you fix the real problem, ideally with the service isolated from untrusted networks.
The cleanest rollback is often just switching the default, since old runtimes can stay installed:
sudo update-alternatives --config java
sudo alternatives --config java
sudo archlinux-java set java-17-openjdk
Use the first on Debian and Ubuntu, the second on Fedora and RHEL, the third on Arch. Services with a hardcoded path ignore this, so edit the unit or JAVA_HOME instead.
To downgrade a package:
apt-cache madison openjdk-17-jre-headless
sudo apt install openjdk-17-jre-headless=OLD_VERSION
sudo apt-mark hold openjdk-17-jre-headless
sudo dnf downgrade java-17-openjdk-headless
sudo dnf history undo ID
sudo pacman -U /var/cache/pacman/pkg/jdk17-openjdk-OLD_VERSION-x86_64.pkg.tar.zst
The Arch command works only if the old package is still in your cache. Unhold with apt-mark unhold when the application is compatible again.
What to expect next
Advisory details will likely firm up over the next days, and distro updates will arrive at different speeds. Re-run the audit as each channel publishes its fix. A host can be fully patched in apt and still exposed through a forgotten tarball. Keep the checklist output from this pass, because it doubles as your inventory for the next Java advisory.



