Podge
Podge

Reputation: 236

Why am I getting an exception when running a JAR file from the command prompt?

Hi I have made a runnable JAR file useing export option on eclipse. However, when I go to run the file via command prompt i get the following

Exception in thread "main" java.lang.NoSuchMethodError
    at org.eclipse.jdt.internal.jarinjarloader.RsrcURLConnection.getInputStream(RsrcURLConnection.java:43)
    at java.net.URL.openStream(Unknown Source)
    at sun.misc.URLClassPath$Loader.getResource(Unknown Source)
    at sun.misc.URLClassPath.getResource(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)    

Does any one have any ideas as to what im doing wrong? pretty new to the whole creating runnable files etc.

Upvotes: 3

Views: 5080

Answers (2)

Santosh
Santosh

Reputation: 17893

Extract the jar file look for the file META-INF/MANIFEST-MF. This file should have an entry

Main-Class : <you fully qualified classname having main method>

Check if the class you mentioned as Main-Class has a main method (public static void main(String[] arg))

Upvotes: 0

Rob Wagner
Rob Wagner

Reputation: 4421

Your jar is compiled with a newer version of java than the computer you are running it on.

Upvotes: 2

Related Questions