在我的64位Mac OSX上,如此链接中所述,尝试使用Java项目中的本机C++库:

https://github.com/bytedeco/javacpp-presets/tree/master/tesseract

但是,当我运行示例时,出现此错误,库liblept.4.dylib未加载,我也不知道该怎么办。

java.lang.UnsatisfiedLinkError: no jnilept in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)

Caused by:java.lang.UnsatisfiedLinkError:/private/var/folders/h8/wpw5p9196v1dz0hcy_s66_5w0000gn/T/javacpp21146551279247/libjnilept.dylib: dlopen(/private/var/folders/h8/wpw5p9196v1dz0hcy_s66_5w0000gn/T/javacpp21146551279247/libjnilept.dylib, 1): Library not loaded: /Users/saudet/projects/bytedeco/javacpp-presets/leptonica/cppbuild/macosx-x86_64/lib/liblept.4.dylib
Referenced from: /private/var/folders/h8/wpw5p9196v1dz0hcy_s66_5w0000gn/T/javacpp21146551279247/libjnilept.dylib

更新:我试图通过Mac端口安装tesseract和leptonica库,此错误已经消失,但是出现了一个新错误:“java无法编写核心转储,有问题的帧leptonica..etc”

所以我再次删除了所有已安装的库,返回到相同的错误

最佳答案

这是已解决的问题:
https://github.com/bytedeco/javacpp-presets/issues/46
虽然尚未发布,但是可以很容易地从源代码进行编译。首先,从GitHub获取JavaCPP和JavaCPP预设的最新源代码,然后在mvn install下运行javacpp,然后在javacpp-presets下运行bash cppbuild.sh install leptonica tesseract,然后再调用mvn install -pl .,leptonica,tesseract

10-04 18:57