1

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!!

  • 1
    1) *"Please help me!!"* Please ask a question & fix that stuck '!' key. *"Thanx!"* Please spell words like 'thanks' correctly, or better still, leave out such noise. 2) [What have you tried?](http://www.whathaveyoutried.com/). In this case I suggest an [SSCCE](http://sscce.org/). – Andrew Thompson Dec 06 '12 at 05:29

1 Answers1

2

My suggestion: catch the InvocationTargetException and then try exception.getCause(). You might then be able to get more details from the underlying SecurityException.

kahowell
  • 27,286
  • 1
  • 14
  • 9