ps aux | grep java Or:
| Tool | Description | Installation | |------|-------------|--------------| | jcmd | Part of JDK, can also generate thread dumps ( jcmd <PID> Thread.print ) | Same as jstack | | kill -3 | Sends a SIGQUIT to the JVM, printing thread dump to stdout (often to application log) | No installation needed, but output goes to catalina.out or systemd journal | | VisualVM | GUI tool (requires JDK as well) | sudo apt install visualvm | | async-profiler | Advanced profiling, includes stack traces | Requires JDK to build | install jstack on ubuntu
sudo dpkg -i oracle-jdk-17_linux-x64_bin.deb Oracle JDK also includes jstack in its bin/ directory. To locate the exact binary: ps aux | grep java Or: | Tool
jcmd -l Then, capture a thread dump:
which jstack If you see output like /usr/bin/jstack , it’s already installed. If you see command not found , proceed with the installation. Since jstack is bundled with the JDK, you have two primary options: Option A: Install OpenJDK (Recommended for Most Users) OpenJDK is the default Java implementation on Ubuntu. Install a full JDK package (not *-jre ). For Java 11 (LTS, very common): sudo apt update sudo apt install openjdk-11-jdk For Java 17 (Current LTS): sudo apt install openjdk-17-jdk For Java 21 (Latest LTS): sudo apt install openjdk-21-jdk For Java 8 (Legacy systems): sudo apt install openjdk-8-jdk After installation, verify that jstack is now accessible: Since jstack is bundled with the JDK, you
jstack -version Example output:
ls -la /usr/bin/jstack Typically, jstack will be symlinked to /usr/lib/jvm/java-11-openjdk-amd64/bin/jstack .