Note that there are some explanatory texts on larger screens.

plurals
  1. POJava equivalent of coredump on uncaught exception
    primarykey
    data
    text
    <p>What is the Java equivalent of a Linux coredump or Windows minidump? I've read about heap dumps and it looks like what I want, but how to trigger them (automatically) on uncaught exceptions?</p> <p>I know about the uncaught exception handler and I'm already using it to print the exception + stack trace and terminate the whole application (otherwise the thread dies and the application keeps running? huh?) Also I found <a href="https://blogs.oracle.com/sundararajan/entry/programmatically_dumping_heap_from_java" rel="noreferrer">this post</a> about how to record heap dumps from code, but if I do that from the unhandled exception handler Java already has caught the exception and the stack trace (and arguments) are gone.</p> <p>I came across the <code>-XX:+HeapDumpOnOutOfMemoryError</code> flag which seems to do what I need, unfortunately only for out of memory exceptions and not for other uncaught exceptions.</p> <p>That's the only things I've been able to get out of google so far. Currently I'm using an attached debugger with exception breakpoints, but that is impractical because it also breaks on handled exceptions, so it can't be used unsupervised.</p> <p><strong>[update on motivation]</strong></p> <p>I want to be able to examine the arguments and local variables of the stack trace to figure out what caused the exception. Its usually null reference exceptions or assertions that fail, and I cannot always guess from the line number what exactly went wrong. In C/C++ I'm used to crash with a coredump/minidump and then examine further what has actually led to the crash.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload