How to easily obtain the stack trace dump of a Java process<! –more–>

The simplest and most direct way to go crazy is to find the ID of this Java process (ps in Linux or jps in Windows) and kill it directly.

1
kill -3 pid

If the Java virtual machine does not hang, it will immediately dump the stack trace; Otherwise, you need to try the following shell command

1
kill pid
1
kill -9 pid

The three correspond to the signals SIGQUIT, SIGTERM, and SIGKILL in Linux, respectively