0
votes

I am trying to create an OCR application using Tesseract. I downloaded the Tesseract library and tested the code sample. But it is giving an error related to the libtesseract302.dll file. please tell me what to do exactly as I am a beginner!

The error is:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract302': Native library (win32-x86-64/libtesseract302.dll) not found in resource path ([file:/C:/Users/neel/Documents/NetBeansProjects/Tess4J/lib/jna.jar, file:/C:/Users/neel/Documents/NetBeansProjects/Tess4J/lib/jai_imageio.jar, file:/C:/Users/neel/Documents/NetBeansProjects/Tess4J/lib/ghost4j-0.3.1.jar, file:/C:/Users/neel/Documents/NetBeansProjects/Tess4J/lib/junit-4.10.jar, file:/C:/Users/neel/Documents/NetBeansProjects/Tess4J/build/classes/, file:/C:/Users/neel/Documents/NetBeansProjects/Tess4J/src/]) at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398) at com.sun.jna.Library$Handler.(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.TessAPI.(TessAPI.java:38) at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:286) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:222) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:173) at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:158) at net.sourceforge.tess4j.example.TesseractExample.main(TesseractExample.java:14)

4

4 Answers

3
votes

I have been working on Tess4j and had similar issues

i If you try to compile the code in 64-bit JVM environment then this message is likely to be shown even after you have placed the .dll files in the project folder

ii If you have not installed Microsoft Visual C++ 2008 redistributable (Specifically 2008) then install that first, it might work http://www.microsoft.com/en-in/download/details.aspx?id=29

1
votes

The exception was due to your trying to load 32-bit DLLs in a 64-bit JVM. Try again using compatible 64-bit DLLs. Check Tess4J Usage page for updated info.

1
votes

Try this

-Djna.library.path=${workspace_loc:/ocr-tess4j-example}/dll/win32-x86-64

or

-Djna.library.path=path/to/dlls

0
votes

Yes, even I was getting the same error like "msvcr110.dll missing", then I downloaded and installed "Microsoft Visual C++ 2008 redistributable" and it is now working fine.

Hope this will work for you as well.