Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Get last exception?

809546Oct 30 2010 — edited Oct 31 2010
I have code with lots of :

try {...}
catch (Exception e)
{
e.printStacktrace();
System.exit(1);
}

I've now added a shutdown hook, and I'd like to be able to get hold of e - the last exception thrown before the JVM shut down.

Is there any way to do this? Failing that, is there any way I can hook into something to record all exceptions thrown?

Ta!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 28 2010
Added on Oct 30 2010
5 comments
1,187 views