Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract302': The specified module could not be found

Dav*_*hta 4 java dll jna

I'm running Eclipse and I know this is a common problem (trying to do some JNA), but all the fixes I have found online do not work:

  • The library is 32bit, but when I do getProperty of sun.arch.data.model it is 32 so this is not the issue.
  • I've tried putting my dll in the src folder, in the root of my eclipse project, but nothing works.
  • 我试过做System.setProperty("jna.library.path","c:/libtesseract302.dll"); 然后把我的dll放在那里,但那不起作用.

这是我用来尝试包含本机库的代码:

public static final TessAPI INSTANCE = (TessAPI) Native.loadLibrary("libtesseract302", TessAPI.class);
Run Code Online (Sandbox Code Playgroud)

小智 7

你需要另一个dll,这是一个libtesseract302依赖:"liblept168.dll"(可以在这里找到:http://code.google.com/p/tesseract-ocr/source/browse/trunk/vs2008/lib/liblept168. dll?r = 553)

尝试这样的事情:

将两个dll文件放在同一个文件夹中(让我们说tesseractlib)

在您的代码中,在加载模块之前,添加:

System.setProperty("jna.library.path", "tesseractlib");
Run Code Online (Sandbox Code Playgroud)

(顺便说一下,你也需要使用一个32位的jvm,这两个dll都是32位而不是64位的库,并且无法加载到64位的jvm中)