簡體   English   中英

導入外部jar后出現NoClassDefFoundError

[英]NoClassDefFoundError after importing an external jar

導入JSoup之后,每次運行Jsoup代碼的第一行時,應用程序都會向我發送此信息

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)

我已經對該主題進行了深入研究,但沒有像lib文件夾,更改順序和導出等許多修復程序對我有用。 任何幫助,將不勝感激。

類路徑:

<?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

在那里檢查所有附有罐子的盒子。

有時之后,可能需要clear + refresh您的項目

希望對您有幫助,

將新的jar添加到我的JaveEE項目時,我遇到了類似的NoClassDefFoundError錯誤。 我按照上面的步驟進行操作,以確保將jar正確包含在構建路徑中。 但是,我仍然收到錯誤消息,對我來說,解決這個問題的辦法是刪除資源並將其添加到tomcat服務器中。

- 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          

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM