Exception in thread “main” java.lang.UnsatisfiedLi

2019-05-06 20:24发布

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.
  • I've tried doing System.setProperty("jna.library.path","c:/libtesseract302.dll"); and then putting my dll there, but that does not work.

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

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

标签: java dll jna
1条回答
爷、活的狠高调
2楼-- · 2019-05-06 20:44

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 )

try something like this :

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

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

查看更多
登录 后发表回答