3
votes

I'm trying to use Tess4J in my project. It doesn't include .dylib files for Mac, so I've built my own Tesseract and am using the .dylib from the Tesseract build. I'm able to load the native library with no issue, and I believe have the Tess4J library linked properly, since I can import it with no issue. However, when I try to create a new instance of Tesseract using:

Tesseract t = new Tesseract();

I'm getting the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Pointer
    at com.ddc.fmwscanner.main.FmwScanner.main(FmwScanner.java:21)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Pointer
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

The only possible problem I can think of is that my Mac Tesseract install version is 3.0.5, whereas Tess4J's .dll files are named "libtesseract3051.dll", indicating that there might be version mismatch between the Tess4J .jar and the .dylib.

Any guidance is appreciated!

1

1 Answers

4
votes

Okay, I figured this out. The Tess4J download includes a "lib" folder. I included this whole folder as a dependency in my project, and am no longer getting NoClassDefFound-related errors.