简体   繁体   中英

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.

您的jar使用比您运行它的计算机更新的java版本进行编译。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM