Tess4J Mac:NoClassDefFoundError [英] Tess4J Mac: NoClassDefFoundError

查看:223
本文介绍了Tess4J Mac:NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在项目中使用Tess4J.它不包含适用于Mac的.dylib文件,因此我已经构建了自己的Tesseract,并且正在使用Tesseract构建中的.dylib.我能够毫无问题地加载本机库,并且我相信Tess4J库已正确链接,因为我可以毫无问题地导入它.但是,当我尝试使用以下方法创建Tesseract的新实例时:

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();

我遇到以下错误:

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)

我能想到的唯一可能的问题是,我的Mac Tesseract安装版本为3.0.5,而Tess4J的.dll文件被命名为"libtesseract3051.dll",这表明Tess4J .jar和该版本之间可能存在版本不匹配的情况. .dylib.

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.

任何指导表示赞赏!

推荐答案

好的,我知道了. Tess4J下载包括一个"lib"文件夹.我将整个文件夹作为依赖项包含在我的项目中,并且不再遇到与NoClassDefFound相关的错误.

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.

这篇关于Tess4J Mac:NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆