2017-04-20 1247 views
2

我剛剛從http://tess4j.sourceforge.net/下載了Tess4J,並將其導入到netbeans中。我正在follwoing this url我遵循每一步正確,但是當我試圖執行我得到以下錯誤。java.lang.UnsatisfiedLinkError:無法找到指定的模塊

錯誤:

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

[最新版本](http://tess4j.sourceforge.net/usage.html)需要Visual C++ 2015可再發行組件包。 – nguyenq

+0

@nguyenq我試過仍然我得到同樣的錯誤。 – animal

+0

沒有解決方法嗎? :/我有同樣的問題 – Juan

回答

1

看來,這是不加載本地的DLL。

  1. Tesseract DLL是用VS2015構建的,因此取決於Visual C++ 2015 Redistributable Packages。安裝它。

  2. Tesseract,Ghostscript和Leptonica Windows 32位和64位DLL分別嵌入tess4j.jar和lept4j.jar中。所以請確保你在課堂路徑上有他們。

  3. 請確保您有類路徑上的所有依賴庫

  4. (該庫可以在Your_downloaded_Tess4J_folder \ lib中找到)請確保您有類路徑(「tessdata」的「tessdata」文件夾文件夾可以在Your_downloaded_Tess4J_folder中找到)。

    爲了更好的理解,請閱讀Tess4J Tutorial

+0

謝謝我解決它之前。但我發現你的答案很有幫助,所以我接受了它,並upvoted。如果你覺得好,請加快我的問題。 – animal

相關問題