Java: catch (Exception e) does not catch all exceptions..

Today I was testing a piece of code that resulted in exception. The result from the exception was output to screen.

I've placed the normal "try..catch" block to control the exception but it was stubborn. Completely ignored the generic exception and kept on moving along its way.

After some research on this strange phenomenon, it turns that the "catch-all" (Exception e) is not catching "everything" when an exception occurs. The explanation came from this other blog post at

There is another class of exceptions called "RuntimeException".

When replacing "Exception" with "RuntimeException" then I was able to regain control of the exception handling and get more details about why it was happening.

Well, mystery solved.