我想在java中使用Jodd庫,因爲我想試試Jerry。 要做到這一點我已經包括圖書館一樣顯示在回答this question,並用下面的代碼:Java:使用Jodd Jerry - NoClassDefFoundError
File file = new File(SystemUtil.getTempDir(), "test.html");
NetUtil.downloadFile("http://de.wikipedia.org/wiki/Toastbrot", file);
Jerry doc = Jerry.jerry(FileUtil.readString(file));
執行該代碼產生以下錯誤消息:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at jodd.lagarto.LagartoParserEngine.<clinit>(LagartoParserEngine.java:22) at jodd.jerry.Jerry$JerryParser.createLagartoDOMBuilder(Jerry.java:80) at jodd.jerry.Jerry$JerryParser.<init>(Jerry.java:73) at jodd.jerry.Jerry.jerry(Jerry.java:121) at jodd.jerry.Jerry.jerry(Jerry.java:53) at sla.htmlf.Main.test(Main.java:36) at sla.htmlf.Main.main(Main.java:19) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334) ... 7 more
at sla.htmlf.Main.test(Main.java:36) at sla.htmlf.Main.main(Main.java:19)當然是指我的項目的類
這是我第一次遇到NoClassDefFound異常。看起來org.slf4j.LoggerFactory丟失了,但是如果我沒有弄錯那是jodd庫使用的東西 - 那麼應該包含在那裏,對吧?
我會很感激一些建議/本
[下載頁面](http://jodd.org/download/index.html)顯示需要哪些附加依賴項。 – Kai