Tess4J Mac: NoClassDefFoundError

爷,独闯天下 提交于 2020-01-03 20:59:26

问题


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:


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.



来源:https://stackoverflow.com/questions/44511562/tess4j-mac-noclassdeffounderror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!