I'm using Method.invoke() to call a function in a third party jar. Sometimes I get a java.lang.reflect.InvocationTargetException thrown. How can you figure out what the real exception was from this?
Asked
Active
Viewed 1,211 times
1 Answers
5
InvocationTargetException.getCause() it uses the normal exception chaining stuff introduced in 1.4

Francis Upton IV
- 19,322
- 3
- 53
- 57
-
There's also getTargetException() but the javadoc indeed suggests to use getCause() that was introduced later. – ewernli Dec 01 '09 at 07:52