0

If I have a small code which get executed from a jar file (code can't be changed), how to take a thread dump. Is there any command line option that can be pass with java to get the thread dump (just like we can do it from heap dump). The problem with jstack PID is that its extremely tough to get PID and attach with jstack because the process finishes in 1 second or so.

So, I was looking for something like

java <something here> jar file here.

Thanks, Vaibhav

nrussell
  • 18,382
  • 4
  • 47
  • 60
  • 2
    At what point of the program do you want to have a thread dump? – Volune Sep 20 '14 at 15:28
  • I want the complete thread dump of the program. – Vaibhav Choudhary Sep 21 '14 at 11:18
  • A thread dump is a snapshot of the program's threads/held locks/etc. at a particular instant in time. There's no "complete thread dump of the program". And if the program executes that quickly, what are you debugging that you need a thread dump for? – Jeffrey Bosboom Sep 21 '14 at 19:49
  • Well, I think you want to check what are the threads that is being created even for that small program. Why don't you put a sleep some where in the program and then capture thread dump? – Arnab Biswas May 06 '15 at 14:17

0 Answers0