简体   繁体   中英

NoClassDefFoundError after importing an external jar

After importing JSoup, everytime the first line of Jsoup code is run, the app gives me this

09-16 16:43:22.567: E/AndroidRuntime(1085): FATAL EXCEPTION: main
09-16 16:43:22.567: E/AndroidRuntime(1085): java.lang.NoClassDefFoundError: org.jsoup.Jsoup
09-16 16:43:22.567: E/AndroidRuntime(1085):     at me.masterejzz.testapp.StartingPoint$1.onEditorAction(StartingPoint.java:55)
09-16 16:43:22.567: E/AndroidRuntime(1085):     at android.widget.TextView.onEditorAction(TextView.java:4185)
09-16 16:43:22.567: E/AndroidRuntime(1085):     at com.android.internal.widget.EditableInputConnection.performEditorAction(EditableInputConnection.java:138)
09-16 16:43:22.567: E/AndroidRuntime(1085):     at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:297)
09-16 16:43:22.567: E/AndroidRuntime(1085):     at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)
09-16 16:43:22.567: E/AndroidRuntime(1085):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-16 16:43:22.567: E/AndroidRuntime(1085):     at android.os.Looper.loop(Looper.java:137)
09-16 16:43:22.567: E/AndroidRuntime(1085):     at android.app.ActivityThread.main(ActivityThread.java:5103)
09-16 16:43:22.567: E/AndroidRuntime(1085):     at java.lang.reflect.Method.invokeNative(Native Method)

I have heavily researched this topic, and none of the fixes work for me like the lib folder thing, changing the order and export and many others. Any help would be appreciated.

Classpath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con"            path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con"     path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="lib" path="libs/jsoup-1.7.2.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
Go to Eclipse -> 
      right click on your Project ->
                       "Properties" ->
                          "Java Build Path" ->
                              "Order and Export" Tab

There check all boxes with attached jars.

Sometimes after, may need clear + refresh your project

Hope it will help you,

I had a similar NoClassDefFoundError error when adding a new jar to my JaveEE project. I followed the steps above make sure that the jar was properly included in the build path. However, I was still getting the error what done the trick for me was to remove and add the resource into the tomcat server.

- Go to Servers
- Right click on the server and select "Add and Remove"
- Pick the resource with the new jar then remove it and it
- Restart the server          

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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