I would like to invoke a method, using Java Reflection.
The problem is that this method (which I wrote) throws an Exception (I created a myCustomException).
You can get the cause of it that would be the original exception.
InvocationTargetException.getCause();
From documentation:
InvocationTargetException is a checked exception that wraps an exception thrown by an invoked method or constructor.
http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html
In your catch block, you could check if exception is from the type you expect and handle it.
One simple approach would be:
try {
...
} catch (InvocationTargetException ite) {
if (ite.getCause() instanceof SomeExceptionType) {
...
} else {
...
}
}