Rate This Document
Findability
Accuracy
Completeness
Readability

jstack

Introduction

jstack is used to view the thread stack information of a Java process.

Installation Mode

Use OpenJDK to install this tool. For Bisheng JDK, it is a built-in tool.

Usage

  • If a Java environment is configured, you can directly run the jstack command.
  • If no Java environment is not configured, run the ps -ef | grep java command to find the Java process. Then, switch to the JDK bin directory and run the ./jstack command.

    Syntax:

    1
    jstack -l $pid > jstack.log
    

    This command is used to save jstack logs to the local jstack.log file.

    Common parameters are as follows:

    Parameter

    Description

    -F

    Forcibly prints the stack information when the jstack does not respond.

    -l

    Adds the lock information in addition to the common stack information.

    -m

    Displays all stack information of the Java and native C/C++ frameworks in hybrid mode.