Resolve the Java.lang.NoClassDefFoundError method for the Eclipse add external jars run _java

Source: Internet
Author: User

Recently found a problem, sometimes repeated to an Android project Add jar and remove jar, found that thecompilation can be passed, but run up when applied to the external jar object, will throw java.lang.NoClassDefFoundError exception. Cause the program to crash.

Look at the project properties and find that the Android dependencies is less than the normal item in Java build path:

Through the comparison with the project before the loss, the difference is found in the engineering root directory of the . Classpath file,<classpathentry exported= "true" kind= "con" path= " Com.android.ide.eclipse.adt.LIBRARIES "/> here the exported turned false, and changed this back to true, Then shut down and open the project and find it OK .


In addition, if you import a jar package is not placed in the \libs directory of the Engineering directory , there will also be a problem, please put the jar package into the \libs directory, or even though it can be compiled, but because the package did not The jar is packaged so that it causes the exception above. Eclipse will automatically package the files in the \libs directory at compile time .

This question has not been seen before, and I don't know if it has anything to do with the Eclipse version and the ADT version.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.