简体   繁体   English

使用cmd运行.jar文件时出现“ NoClassDefFoundError”

[英]“NoClassDefFoundError” when running .jar file with cmd

So I have two files to compile into jar file: Testfield.class (which i make from Testfield.java via javac command) and manifest.txt . 因此,我有两个文件可以编译成jar文件: Testfield.class (我通过javac命令从Testfield.java )和manifest.txt

Now I'm getting this noclassdeffounderror when im running my jar file in cmd it goes as follows: 现在,当我在cmd中运行我的jar文件时,我得到了这个noclassdeffounderror ,它如下:

Exception in thread "main" java.lang.noclassdeffounderror: Testfield (wrong name: testfield/Testfield)

What's the deal ? 这是怎么回事 ?

edit* Testfield.class file contains the following line: edit * Testfield.class文件包含以下行:

Main-Class: Testfield

The NoClassDefFoundError indicates that the classloader (in this case java.net.URLClassLoader), which is responsible for dynamically loading classes, cannot find the .class file for the class that you're trying to use can you post your manifest? NoClassDefFoundError指示负责动态加载类的类加载器(在本例中为java.net.URLClassLoader)找不到您要使用的类的.class文件,您可以发布清单吗?

You can also try to run javac in -verbose 您也可以尝试在-verbose运行javac

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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