Alex Rivera | Logout

Get a list of all threads currently running in Java

Asked 2009-08-24T16:30:11.220
286

Is there any way I can get a list of all running threads in the current JVM (including the threads not started by my class)?

Is it also possible to get the Thread and Class objects of all threads in the list?

I want to be able to do this through code.

Edit
Report

1 Answer

31

Yes, take a look at getting a list of threads. Lots of examples on that page.

That's to do it programmatically. If you just want a list on Linux at least you can just use this command:

kill -3 processid

and the VM will do a thread dump to stdout.

answered 2009-08-24T16:31:37.877

Your Answer