Re: "Unable to load library 'libtesseract302': The specified module could not be found." error

6,877 views
Skip to first unread message

Quan Nguyen

unread,
Jan 18, 2013, 3:12:00 PM1/18/13
to tesser...@googlegroups.com
JVM 64-bit cannot load Tesseract and Leptonica 32-bit DLLs. You would need JVM 32-bit.

On Friday, January 18, 2013 8:11:56 AM UTC-6, Deniz Atak wrote:
Hi,

I am trying to run Tess4J in 64 JVM from Netbeans IDE and getting this error:
Testcase: testTessBaseAPIRect(net.sourceforge.tess4j.TessAPI1Test):    Caused an ERROR
Unable to load library 'libtesseract302': The specified module could not be found.

java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract302': The specified module could not be found.

    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:169)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:242)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:205)
    at com.sun.jna.Native.register(Native.java:1033)
    at net.sourceforge.tess4j.TessAPI1.<clinit>(TessAPI1.java:37)
    at net.sourceforge.tess4j.TessAPI1Test.testTessBaseAPIRect(TessAPI1Test.java:72)


As far as I searched, I think this error message is because of the JVM. But I am not sure. The .dll file is in the project folder, but it seems JVM can not find it..Can anyone recommend a link to run Tess4J test from scratch?

Quan Nguyen

unread,
Dec 29, 2013, 11:46:50 PM12/29/13
to tesser...@googlegroups.com
Tesseract and Leptonica 64-bit DLLs are now available from Tesseract .NET wrapper project.

On Monday, March 4, 2013 3:07:40 AM UTC-6, Sudarshan Sreenivasan wrote:
Any work around for this ?

Geetanjali P

unread,
Jul 23, 2014, 9:06:18 AM7/23/14
to tesser...@googlegroups.com
Hi All,
 
I am having a similar issue.
 
Basically I am able to test Tess4j (below code) using 32 bit JVM with 32 bit dll's (libtesseract302.dll, liblept168.dll) on my windows 7 m/c in Eclipse. However now when I trying to run the same code using 64 bit JVM and 64 bit dll's (downloaded from Tesseract .NET wrapper project.) I am getting error pasted below.
 
package ocr;
import java.io.*;
import net.sourceforge.tess4j.*;
 
public class example {
 public static void main(String[] args) {
 File imageFile = new File("c:/temp/IMG123.tif");
 Tesseract instance = Tesseract.getInstance(); //
 
try {
 
String result = instance.doOCR(imageFile);
 System.out.println(result);
 
} catch (TesseractException e) {
 System.err.println(e.getMessage());
 }
 }
 }
ECLIPSE ERROR
 
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.TessAPI.<clinit>(TessAPI.java:38)
 at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:293)
 at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:227)
 at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:176)
 at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:159)
 at ocr.example.main(example.java:15)

When I click on the error, it is taking me to the following code in the TessAPI.java
 
static final String LIB_NAME = "libtesseract302";

public static final String LIB_NAME_NON_WIN = "tesseract";

/**

* An instance of the class library.

*/

Public static final TessAPI INSTANCE = (TessAPI) Native.loadLibrary(WINDOWS ? LIB_NAME : LIB_NAME_NON_WIN, TessAPI.class);

 
Can someone please share some pointers how to solve this problem.
 
Thanks in advance
 
Regards,
Geetanjali
 
=========================================================================================
Message has been deleted
Message has been deleted
Message has been deleted

Quan Nguyen

unread,
Jul 24, 2014, 3:56:10 PM7/24/14
to tesser...@googlegroups.com
Check out the Tutorial: Development with Tess4J.

You may need to set jna.library.path system property or change the Path environment variable.

Dineshkumar

unread,
Aug 4, 2014, 8:29:34 AM8/4/14
to tesser...@googlegroups.com
Hi every one.

I am trying to use tesseract OCR in Java for a 64 bit JVM. I have tried all the solutions which are mentioned.

i) Added the dll files for 64 bit JVM taken from "Tesseract .NET wrapper project." (https://github.com/charlesw/tesseract/tree/master/src/lib/TesseractOcr/x64)

ii) Changed the 
jna.library.path value. 

But still i am getting the same error as before.

java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract302': Native library (win32-x86-64/libtesseract302.dll) not found in resource path.

Kindly reply whether there is an option to use Tesseract OCR in a 64 bit JVM and advise the solution please. 

Shree Devi Kumar

unread,
Aug 4, 2014, 9:03:31 AM8/4/14
to tesser...@googlegroups.com
​For similar error while running vietocr beta Quan had suggested:

you'll probably need to install the VC++ Runtime Redistributable. Check http://tess4j.sourceforge.net/usage.html for download links.

Shree Devi Kumar
____________________________________________________________
भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com


--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at http://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/afe888dc-9368-4cd0-b87f-7f3862a1e932%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Geetanjali P

unread,
Aug 6, 2014, 6:02:20 AM8/6/14
to tesser...@googlegroups.com
Hi,
 
I do have the VC++ 2013 redistrubutable but still giving me the same error. I do have other versions of VC++ redristibutables like 2005(x64), 2008 (x86, x64), 2010 (x86, x64). They might have been installed along with other s/w installations. Could that be a problem?
 

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

Thanks
Geetanjali

Shree Devi Kumar

unread,
Aug 6, 2014, 6:30:26 AM8/6/14
to tesser...@googlegroups.com


Visual Studio 2012 x86 and x64 Runtimes

Since tesseract and leptonica binaries are compiled with Visual Studio 2012 you'll need to ensure you have the Visual Studio 2012 Runtime installed. This can be found here.


So try again with the VS2012 runtime.


 

Shree Devi Kumar
____________________________________________________________
भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com


Reply all
Reply to author
Forward
0 new messages