Is it possible to get a thread dump of a Java Web Start application? And if so, how?
It would be nice if there were a simple solution, which would enable a non-developer (customer) to create a thread dump. Alternatively, is it possible to create a thread dump programmatically?
In the Java Web Start Console I can get a list of threads by pressing 't' but stacktraces are not included.
If answers require certain java versions, please say so.
To take a thread dump, navigate to the console used to launch the Java application, and press the CTRL and Break keys together. It's worth noting that, on some keyboards, the Break key isn't available. Therefore, in such cases, a thread dump can be captured using the CTRL, SHIFT, and Pause keys together.
A thread dump is a snapshot of the state of all threads that are part of the process. The state of each thread is presented with a so called stack trace, which shows the contents of a thread's stack. Some of the threads belong to the Java application you are running, while others are JVM internal threads.
In the console, press V rather than T:
t: dump thread list
v: dump thread stack
This works under JDK6. Don't know about others.
Alternative, under JDK5 (and possibly earlier) you can send a full stack trace of all threads to standard out:
Under Windows: type ctrl-break in the Java console.
Under Unix: kill -3 <java_process_id>
(e.g. kill -3 5555). This will NOT kill your app.
One other thing: As others say, you can get the stacks programatically via the Thread
class but watch out for Thread.getAllStackTraces()
prior to JDK6 as there's a memory leak.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434648
Regards,
scotty
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With