Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.
  • 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);
like image 879
David Zorychta Avatar asked Mar 23 '23 09:03

David Zorychta


1 Answers

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 )

like image 164
mabroukb Avatar answered Apr 06 '23 22:04

mabroukb