I am thinking of creating a debug tool for my Java application.
I am wondering if it is possible to get a stack trace, just like Exception.printStackTrace()
You can also send a signal to the JVM to execute Thread.getAllStackTraces() on a running Java process by sending a QUIT signal to the process.
On Unix/Linux use:
kill -QUIT process_id, where process_id is the process number of your Java program.
On Windows, you can press Ctrl-Break in the application, although you usually won't see this unless you're running a console process.
JDK6 introduced another option, the jstack command, which will display the stack from any running JDK6 process on your computer:
jstack [-l]
These options are very useful for applications which are running in a production environment and cannot be modified easily. They're especially useful for diagnosing runtime deadlocks or performance problems.
http://java.sun.com/developer/technicalArticles/Programming/Stacktrace/ http://java.sun.com/javase/6/docs/technotes/tools/share/jstack.html