本文介绍了线程“main”中的异常java.lang.UnsatisfiedLinkError:无法加载库'libtesseract302':找不到指定的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Eclipse,我知道这是一个常见的问题(尝试做一些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:


  • 该库是32位,但是当我执行sun.arch.data.model的getProperty时它是32,所以这不是问题。

  • 我是尝试把我的dll放在sclipse文件夹中,在我的eclipse项目的根目录中,但没有任何效果。

  • 我尝试过做System.setProperty(jna.library.path, C:/libtesseract302.dll);然后将我的dll放在那里,但这不起作用。

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

Here is the code I use to try to include the native library:

public static final TessAPI INSTANCE = (TessAPI) Native.loadLibrary("libtesseract302", TessAPI.class);


推荐答案

你需要另一个dll,这是一个libtesseract302依赖: liblept168.dll
(可以在这里找到:)

you need another dll, it's a libtesseract302 dependency : "liblept168.dll"( it could be found here : http://code.google.com/p/tesseract-ocr/source/browse/trunk/vs2008/lib/liblept168.dll?r=553 )

尝试这样的事情:

将两个dll文件放在同一个文件夹中(比如tesseractlib)

put both dll files in same folder ( let's say tesseractlib )

,在加载模块之前,添加:

in your code, before loading the module, add :

System.setProperty("jna.library.path", "tesseractlib");

(顺便说一下,你也需要使用32位的jvm,这两个dll都不是32位的64位库,不能在64位jvm中加载

( btw, you need to use a 32-bit jvm too, both dll are 32-bit not 64-bit libraries, and cannot be loaded in a 64-bit jvm )

这篇关于线程“main”中的异常java.lang.UnsatisfiedLinkError:无法加载库'libtesseract302':找不到指定的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 22:07