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

标签 java ocr tesseract tess4j

我刚刚从 http://tess4j.sourceforge.net/ 下载了 Tess4J并将其导入 netbeans。我正在关注 this url我正确地遵循了每一步,但是当我尝试执行时,我遇到了以下错误。

错误:

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

最佳答案

似乎它没有加载 native Dll。

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

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

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

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

    请阅读Tess4J Tutorial以便更好地理解。

关于java.lang.UnsatisfiedLinkError : The specified module could not be found 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43522582/

相关文章:

java - 如何在java中的特定字符之后修剪字符串

java恢复中断下载

image-processing - 计算机视觉 - 使用图像匹配或 OCR 识别纯文本书籍的页面?

python - 操作系统错误 : [WinError 740] The requested operation requires elevation

android - android中最好的OCR(光学字符识别)示例

java - 无法解析名称为 'streamrecords' 的 servlet 中名称为 'spring' 的 View

java 能否在一个构造器( constructor )中调用另一个构造器

machine-learning - 使用 Dlib 库进行对象检测

c# - 使用C#在Emgucv中获取图像角度的NaN

python - 如何从图像中的表中提取文本?