[英]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. 嗨我已经在eclipse上使用导出选项制作了一个可运行的JAR文件。 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. 解压缩jar文件,查找文件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)
) 检查您提到的Main类的类是否有main方法( public static void main(String[] arg)
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.