1
我正在使用Method.invoke()在第三方jar中調用函數。有時我會拋出java.lang.reflect.InvocationTargetException。你怎麼能找出真正的例外是什麼?java.lang.reflect.InvocationTargetException - 確定實際錯誤?
我正在使用Method.invoke()在第三方jar中調用函數。有時我會拋出java.lang.reflect.InvocationTargetException。你怎麼能找出真正的例外是什麼?java.lang.reflect.InvocationTargetException - 確定實際錯誤?
InvocationTargetException.getCause()它使用1.4
引入正常的異常鏈的東西還有getTargetException(),但確實的javadoc建議使用的getCause(),這是後來推出。 – ewernli 2009-12-01 07:52:00