On Ubuntu: Install Jstack

To use jstack to troubleshoot a Java application, follow these steps:

By following these steps, you should now have jstack installed on your Ubuntu system and be able to use it to troubleshoot Java applications. install jstack on ubuntu

jstack is a command-line utility that comes bundled with the Java Development Kit (JDK). It is used to print Java stack traces of Java threads for a specified Java process. This tool is invaluable for developers and system administrators who need to debug applications, diagnose deadlocks, or identify performance bottlenecks (CPU spikes). To use jstack to troubleshoot a Java application,

Because jstack is part of the JDK (not the JRE), you cannot simply install it as a standalone package; you must install the full Java Development Kit. By following these steps, you should now have


If you’re a Java developer or a system administrator troubleshooting a production Java application on Ubuntu, you’ve likely encountered the need to inspect thread stacks, detect deadlocks, or analyze high CPU usage. The go-to tool for this task is jstack. However, unlike apt packages like vim or curl, jstack doesn’t come as a standalone package. This guide will walk you through everything you need to know about installing jstack on Ubuntu, verifying your setup, and using it effectively.

sudo apt install openjdk-21-jdk
Go to Top