Tesseract - The specified module could not be found

5.5k views Asked by At

In my Java application, I want to extract text from images. I downloaded Google's Tesseract OCR and installed it in my Windows XP machine. I followed the tutorial Tess4J - JNA wrapper for Tesseract, unfortunately this error came up:

Exception in thread "main" java.lang.UnsatisfiedLinkError: The specified module could not be found.

at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1759)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.<init>(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:78)
at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:40)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:360)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:273)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:205)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:189)
at ocr.Main.main(Main.java:13)
Java Result: 1

I found similar issues here in StackOverFlow, but nothing seems to work. I hope you can help me with this!

Here's my project structure in Netbeans IDE 7.2:

enter image description here

2

There are 2 answers

3
Harsh Middha On

looks like tesseract uses JNA ...try adding its jar from here https://github.com/twall/jna

1
Sajan Franco On

I am using 64 bit version of the dlls in

lib\win32-x64

folder

  1. API-MS-Win-Core-Kernel32-Private-L1-1-1.dll
  2. api-ms-win-core-privateprofile-l1-1-1.dll
  3. api-ms-win-service-private-l1-1-1.dll
  4. gsdll64.dll
  5. liblept1741.dll
  6. libtesseract3051.dll

for which Microsoft Visual C++ 2015 Redistributable x64 (vc_redist.x64.exe) is necessary.