Exception in thread "main" java.lang.NoClassDefFoundError:
时间: 2023-08-23 13:07:16 浏览: 150
Exception in thread "main" java.lang.NoClassDefFoundError: concept/person (wrong name: concept/Person)是由于类名与方法名的大小写问题导致的。在Windows系统中,编译器在编译过程中不严格区分大小写,因此只编译出了一个类person,并生成了class person。而在代码中,却使用了类名Person来创建对象,导致找不到或无法加载主类concept.Person,从而出现错误提示。\[1\]
在Linux中调用执行jar包时,由于没有配置环境变量,程序不知道去哪里寻找这些类文件,所以出现了以上错误。在Eclipse中执行正确是因为配置了工程的环境,通过build path已经将所需的类文件以jar包的形式添加到工程中。\[2\]\[3\]
#### 引用[.reference_title]
- *1* [出现报错:Exception in thread "main" java.lang.NoClassDefFoundError](https://blog.csdn.net/weixin_45794474/article/details/103231562)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [执行jar包出错:Exception in thread "main" java.lang.NoClassDefFoundError](https://blog.csdn.net/g1269420003/article/details/81630031)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文