Hesam Qodsi
Hesam Qodsi

Reputation: 1585

What does this JDK error message means?

I am not familiar with Java and JDK. I have a java program as a .jar file that i want to run it in ubuntu 12.04. I use this command:

java -jar SAStoSEP.jar

But i get this error message :

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
    at SAStoSeP.main(SAStoSeP.java:56)
    ... 5 more

What does this error means?

Upvotes: 0

Views: 4382

Answers (5)

Stephen C
Stephen C

Reputation: 718678

Since this is a proprietary project, we cannot tell you what is causing a particular exception to be thrown. That would entail looking at the source code!!

The correct way to solve this is to ask the support folks for the product to explain the problem and tell you how to avoid it. For a start, anything that throws a generic exception to the user like that is arguably a bug. And if you have paid money for the right to use a product, you have a reasonable expectation of reliability ... and support.

However, given the method that is throwing the exception ... and the exception itself ... I would guess is that SAStoSeP is expecting some command line arguments. (A poorly written main(String[] args) method might attempt to access arg[0] without checking args.length. That would result in an ArrayIndexOutOfBounds at index 0. And you didn't supply any arguments ...) So check the documentation on how you are supposed to that command.

Upvotes: 0

René Link
René Link

Reputation: 51323

In the JarRsrcLoader.main method a method invocation is done usinig refelction (JarRsrcLoader.java:58) to invoke SAStoSeP.main.

While invoking that method an ArrayIndexOutOfBoundsException was thrown (SAStoSeP.java:56). This Exception was wrapped in an InvocationTargetException.

From the Method javadoc:

throws InvocationTargetException - if the underlying method throws an exception.

Upvotes: 1

Guillaume Poussel
Guillaume Poussel

Reputation: 9822

In your main() method of SAStoSeP class, you are trying to access the first element of an empty list. Thus, you get ArrayIndexOutOfBoundsException. It has nothing to do with JDK. Possible causes are :

  • The program reads argument from the command line, and you are not providing any.
  • This is not the main class you should run. You are launching a runnable JAR file, but it could contain many main() method.

Upvotes: 1

acsadam0404
acsadam0404

Reputation: 2831

The error is self explanatory. Check your code at line 56 at SastoSep.java http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayIndexOutOfBoundsException.html

Upvotes: 0

Ash
Ash

Reputation: 9426

It means that on line 56 of SAStoSeP (in the main method), there was an ArrayIndexOutOfBoundsException thrown.

Because the main method was invoked via reflection, it was wrapped in an InvocationTargetException, which is why the stack trace is split into two sections.

Upvotes: 0

Related Questions