Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strategies/techniques for crash reporting in Java

I'm developing a new Java desktop application and would like to include a crash reporting facility - you know the kind of thing - program crashes, box pops up asking user to click okay to send it, etc.

I'm comfortable with how the error will be sent back to our servers - probably via a simple web service. What I'm more unsure about is how the mechanism for capturing the failure should be implemented?. I would welcome any advice from anyone that has implemented something similar.

like image 868
William Avatar asked Dec 05 '22 05:12

William


1 Answers

There is a command line option you can give the JVM that will run a batch file after the JVM crashes with a memory dump. All you do is create a external program that does the error reporting and then use the JVM option to send the core dump in email using the utility you made.

-XX:-HeapDumpOnOutOfMemoryError -XX:OnError="<cmd args>;<cmd args>"
like image 106
djangofan Avatar answered Dec 14 '22 03:12

djangofan