Search code examples
javaocrtess4j

Missing slf4j in tess4j


I want to test tess4j to do OCR. I used the following tutorial for a first example: http://tess4j.sourceforge.net/codesample.html I included the required libraries, but I am getting the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at net.sourceforge.tess4j.Tesseract.<clinit>(Unknown Source)
    at tess4jexample.TesseractExample.main(TesseractExample.java:10)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 2 more

Does anyone knows a solution for this?


Solution

  • There has where still some dependencies missing, which have not been mentioned on the mavenrepository:

    • logback-core-1.1.6.jar
    • slf4j-api-1.7.21.jar

    I think now it is working :-) Thank you nguyenq for this hint, to check the dependencies.