简体   繁体   English

从命令提示符运行JAR文件时,为什么会出现异常?

[英]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.

相关问题 为什么在运行JXTA应用程序时出现此异常? - Why I am getting this exception when running a JXTA app? 从CMD运行JAR文件时,为什么会收到NoClassDefFoundError? - Why am I receiving a NoClassDefFoundError when running a JAR file from CMD? 尝试将jar中的文件复制到磁盘时,为什么会出现“ nullfiles”? - Why am I getting 'nullfiles' when trying to copy a file from inside a jar to disk? 从命令行创建JAR文件时,为什么会得到这个奇怪的输出? - Why am I getting this weird output when creating a JAR file from commandline? 使用命令提示符从Java代码运行jar文件 - Running a jar file from java code using command prompt 通过双击在命令提示符下运行 .jar 文件 - Running a .jar file in a command prompt from double click 当我从 Linux 的命令行运行 Java class 文件时,为什么会出现 NoClassDefFoundError? - Why am I getting a NoClassDefFoundError when I run a Java class file from the command line in Linux? 在命令提示符下运行jar文件时,如何获取用户输入? - How do I get user input when I run my jar file from command prompt? 为什么在此文件上运行 readAllBytes 时会收到 NoSuchFileException - Why am I getting a NoSuchFileException when running readAllBytes on this file 为什么从文件重定向输入而不是为Java程序手动输入时出现异常? - Why am I getting an exception when redirecting input from file, but not manual input for a Java program?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM