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

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

我刚刚从 http://tess4j.sourceforge.net/ and imported it in netbeans. I am follwoing this url 下载了 Tess4J 我正确地遵循了每一步但是当我尝试执行时我遇到了以下错误。

错误:

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

我搜索并发现人们建议更新到 Visual Visual C++ Redistributable Packages for Visual Studio 2013,我这样做了,但结果没有帮助,我仍然遇到同样的问题。我不知道我做错了什么下面是我的代码。

代码:

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());
}
}
}

似乎没有加载本机 Dll。

  1. Tesseract DLL 是使用 VS2015 构建的,因此依赖于 Visual C++ 2015 Redistributable Packages。安装它。

  2. Tesseract、Ghostscript 和 Leptonica Windows 32 位和 64 位 DLL 分别嵌入在 tess4j.jar 和 lept4j.jar 中。因此,请确保将它们放在 class 路径上。

  3. 确保您在 class 路径上拥有所有依赖库(库可以在 Your_downloaded_Tess4J_folder\lib 中找到)

  4. 确保 class 路径上有“tessdata”文件夹(“tessdata”文件夹可以在 Your_downloaded_Tess4J_folder 中找到)。

    请阅读 Tess4J Tutorial 以获得更好的理解。