How to create a thread dump
Sometimes it can be useful to produce a so called thread dump when debugging a Java application like beaTunes. This is for example the case when the application freezes, i.e. does not react to input anymore. In this context it is usually also helpful to know, whether the main beaTunes window can still be resized and whether it is the topmost window.
To capture a thread dump on OS X, please follow these directions:
- Open the application
Terminal.app
(it's on every OS X system, typically under /Applications/Utilities) - Type in
ps -x | grep beaTunes
, then hit Enter - You'll see two lines - one of which contains the word
grep
and the other one the full path to the beaTunes application. We are interested in the first number in that latter line.
Example:
Macintosh-7:~ yourUsername$ ps -x | grep beaTunes2
18859 ?? S 0:13.15 /Applications/beaTunes2.app/Contents/MacOS/beaTunes2 -psn_0_7624517
18889 s005 R+ 0:00.00 grep beaTunes2
- Then type in
jstack 18859 > stack.txt
- but replace18859
with the first number of that line.
This should produce a file called stack.txt
in your
home folder. It contains the thread dump.