简体   繁体   English

jar文件导致NoClassDefFoundError

[英]jar file causes NoClassDefFoundError

I created a java project in eclipse and then i generated a runnable jar out of it. 我在eclipse中创建了一个Java项目,然后从中生成了一个可运行的jar。 the java project has a class named DrivingModule. Java项目有一个名为DrivingModule的类。 the jar file was imported in to an android project. jar文件已导入到android项目中。 but the problem is, when i run the android project the app crash as long as i use the class DrivingModule and i receive the following error 但是问题是,当我运行android项目时,只要我使用类DrivingModule,应用程序就会崩溃,并且收到以下错误

*06-01 11:38:10.481: E/AndroidRuntime(16751):   Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available*

and if i commented out the class DrivingModule, the App works normall. 如果我注释掉了DrivingModule类,则该应用正常运行。 i referred to some questions but mainely they were explaining how to generate the jar and how to build the path, but i could not find any post about how to solve the error i am receiving. 我提到了一些问题,但主要是他们在解释如何生成jar和如何构建路径,但是我找不到有关如何解决我收到的错误的任何帖子。

why that class causes the App to crash and throw such error? 为什么该类导致App崩溃并引发此类错误?

update 更新

after refering to the answer of Bhaumik Thakkar the App did nt work until I checked the box of the added jar as shown in the image below 引用Bhaumik Thakkar的答案后,该应用程序没有起作用,直到我选中了添加的jar的框,如下图所示

在此处输入图片说明

将罐子放入-> jdk-> lib-> ext,然后重试。

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

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