Evasive cause inside InvocationTargetException <p>Executing a Java code I capture an InvocationTargetException. Using the printStackTrace method I get the following:</p> <pre><code>java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at Tester.main(Tester.java:180) Caused by: java.lang.NullPointerException at [...] (it doesn't really matters) </code></pre> <p>My code checks several programs written by other persons, so the cause shown by printStackTrace is varied. However, if I try to get just the internal cause using method getCause, the result is always a disgusting null! </p> <p>Java 6 API says that, from release 1.4 in advance, getCause returns the cause exception provided during construction... should I assume that Method.invoke does not construct the exception properly, or am I losing something?</p> <p>Thanks in advance</p>