Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.UnsatisfiedLinkError: The specified module could not be found

I just downloaded Tess4J from http://tess4j.sourceforge.net/ and imported it in netbeans. I am follwoing this url i followed every step properly but when i am trying to execute i am getting below error.

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.util.LoadLibs.getTessAPIInstance(LoadLibs.java:75)
    at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
    at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:367)
    at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:280)
    at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:212)
    at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:196)
    at recognizer.Recognizer.main(Recognizer.java:17)
Java Result: 1

I searched and found that people are suggesting to update to Visual Visual C++ Redistributable Packages for Visual Studio 2013 which i did but it turned out no help, i am still getting the same issue. I don't know what am i doing wrong below is my code.

Code:

import java.io.*;
import net.sourceforge.tess4j.*;

public class Recognizer {
public static void main(String[] args) {
File imageFile = new File("image.jpg");
Tesseract instance = new Tesseract();//

try {

String result = instance.doOCR(imageFile);
System.out.println(result);

} catch (TesseractException e) {
System.err.println(e.getMessage());
}
}
}
like image 535
animal Avatar asked Apr 20 '17 14:04

animal


1 Answers

Seems it is not loading the native Dlls.

  1. The Tesseract DLLs were built with VS2015 and therefore depend on the Visual C++ 2015 Redistributable Packages. Install it.

  2. Tesseract, Ghostscript, and Leptonica Windows 32- and 64-bit DLLs are embedded in tess4j.jar and lept4j.jar, respectively. So make sure you have them on the class path.

  3. Make sure you have all the dependency libraries on the class path (The Libraries can be found in Your_downloaded_Tess4J_folder\lib )

  4. Make sure you have "tessdata" folder on the class path (The "tessdata" folder can be found in Your_downloaded_Tess4J_folder).

    Please read the Tess4J Tutorial for better understanding.

like image 110
Lalith J. Avatar answered Oct 29 '22 11:10

Lalith J.