Install Jstack On Ubuntu May 2026

jstack is a command-line utility that comes with the Java Development Kit (JDK). It prints Java stack traces of threads for a given Java process, helping debug deadlocks, thread contention, and performance issues.

To locate the exact binary:

update-alternatives --list jstack

Or:

ls -la /usr/bin/jstack

Typically, jstack will be symlinked to /usr/lib/jvm/java-11-openjdk-amd64/bin/jstack. install jstack on ubuntu

If you have multiple JDK versions installed, you can switch the default:

sudo update-alternatives --config java
sudo update-alternatives --config jstack

The jstack command is part of the Java Development Kit (JDK), specifically the openjdk-xx-jdk package (where xx is the Java version).

Here’s a detailed, feature-length guide to installing and using jstack on Ubuntu. jstack is a command-line utility that comes with


sudo apt update
sudo apt install openjdk-17-jdk-headless

The -headless version includes jstack, jmap, jstat, etc., but not GUI tools.

sudo apt install openjdk-17-jdk

Since jstack is bundled with the JDK, you need to install a JDK (not just JRE). Or: ls -la /usr/bin/jstack

# List Java processes
ps aux | grep java

jstack -l <PID> > full_thread_dump.txt