Reputation: 33
When run this statement from other Java program.
mainMethod.invoke(null,(Object) args);
I got this Exception
I'm dying!
I'm not dead yet!
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.fourgid.ot.action.RunThread.run(RunThread.java:59)
***Caused by: java.lang.SecurityException
at Main$1.checkExit(Main.java:21)
at java.lang.Runtime.exit(Runtime.java:88)
at java.lang.System.exit(System.java:904)
at Main.main(Main.java:30)***
... 5 more
i just to show only caused exception that is SecurityException
with messages and line numbers(above highlighted text) given by JVM.
I am developing an application for compile and execute the program on web.
Thank you!!
Upvotes: 1
Views: 993
Reputation: 30146
My suggestion: catch the InvocationTargetException
and then try exception.getCause()
. You might then be able to get more details from the underlying SecurityException
.
Upvotes: 2