Java, Maven and Gradle 25 cheatsheet
Java, Maven and Gradle 25: Diagnostics
6 common Java, Maven and Gradle 25 tasks.
Take a thread dump
Print every thread's stack. Useful for hangs and deadlocks.
jcmd 12345 Thread.print
Write a heap dump
Save the heap to a file to analyze memory leaks.
jcmd 12345 GC.heap_dump /tmp/heap.hprof
Caution: A heap dump can be as large as the heap and may contain sensitive data.
Dump the heap on OutOfMemoryError
Have the JVM write a heap dump automatically when memory runs out.
java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -jar app.jar