1. Introduction
Jstack is used to print out the Java stack information for a given Java process ID or core file or remote debugging service, and if it is on a 64-bit machine, the option "-J-D64" needs to be specified, and the Jstack usage of Windows only supports the following way:
Jstack [-l] PID
If a Java program crashes generating a core file, the Jstack tool can be used to obtain information about the core file's Java stack and the native stack, making it easy to know how the Java program crashes and where the problem occurs in the program. In addition, the Jstack tool can be attached to a running Java program to see the Java stack and the native stack of the Java program that was running, and jstack is useful if the Java program that is running now renders hung state.
2. Command format
jstack [option] pid
jstack [option] executable core
jstack [option] [[Email Protected]]remote-hostname-or-ip
3. Common parameter description
1), Options:
Executable Java executable from which, the core dump was produced.
(Probably the Java executable that generated the core dump)
Core dump file that will be printed with the information
Remote-hostname-or-ip the host name or IP of the Remote Debug service
Server-id Unique ID, if multiple Remote debug services on a single host
2), Basic parameters:
-F when ' jstack [-l] PID ' does not have a corresponding time to force the printing stack information
-L long list. Prints additional information about the lock, such as the ownable synchronizers list belonging to Java.util.concurrent.
-M prints all of the stack information for Java and Native/C + + frameworks.
-H | -help Printing Help information
The PID requires the Java process ID of the configuration information to be printed and can be queried with JPS.
4. Examples of Use
Jstack command (Java Stack Trace)