How to get a thread and heap dump of a Java process on Windows that’s not running in a console

You can use jmap to get a dump of any process running, assuming you know the pid.

Use Task Manager or Resource Monitor to get the pid. Then

jmap -dump:format=b,file=heap.hprof <pid>

to get the heap for that process.

For systems where bash and pgrep are installed and a single Java process is running, try:

jmap -dump:format=b,file=heap.hprof $(pgrep java)

Leave a Comment