I want to use the Jodd library in java because I want to try Jerry out. To do that I've included the library like shown in the answer to this question and used the following code:
File file = new File(SystemUtil.getTempDir(), "test.html");
NetUtil.downloadFile("http://de.wikipedia.org/wiki/Toastbrot", file);
Jerry doc = Jerry.jerry(FileUtil.readString(file));
Executing this code produces the following error message:
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) of course is referring to classes of my project
This is the first time I encountered a NoClassDefFound exception. It appears that org.slf4j.LoggerFactory is missing, but if I'm not mistaken thats something the jodd library uses - which then should be included there, right?
I'd really appreciate some advice/help with this
As you can see on the download page, jodd-lagarto module (that Jerry belongs to) depends on SLF4J logging library.
Please read more about logging in Jodd. On this page you can also find some quick steps to setup your environment and make it work.
These steps are:
With SLF4J you can choose logging framework you want to use: none, log4j, commons etc; Jodd authors recommend logback.