2

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?

pexmar
  • 331
  • 2
  • 12

2 Answers2

2

Tess4J has several dependencies. You'll need to include them in the classpath.

nguyenq
  • 8,212
  • 1
  • 16
  • 16
1

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.

pexmar
  • 331
  • 2
  • 12