How to invoke a method which throws an Exception using Java Reflection?
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 ). When I add a try/catch clause, I can't run my project, because Eclipse says "the catch clause is unreachable". Here is when I try to invoke myMethod in the class MyClass : 270. myMethod.invoke(null, myParam); // NB : null because myMethod is static When myMethod does not throw a MyCustomException , eveything is fine. But when it throws a MyCustomException , I get this error message : Let's say I try to invoke fooMethod() , which is in the