tesseract java,在Java中使用的tesseract API时java.lang.UnsatisfiedLinkError中的异常

I'm trying to use the Java JNA wrapper for Tesseract OCR API but I keep getting java.lang.UnsatisfiedLinkError exception

I made sure that I use a 32 bit JVM. Following is the exception trace.

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.(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:79)

at net.sourceforge.tess4j.TessAPI.(TessAPI.java:40)

at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:360)

at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:273)

at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:205)

at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:189)

at net.sourceforge.tess4j.Main.main(Main.java:12)

Any obvious mistakes that I'm doing?

package net.sourceforge.tess4j.example;

import java.io.File;

import net.sourceforge.tess4j.*;

public class TesseractExample {

public static void main(String[] args) {

File imageFile = new File("eurotext.tif");

Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping

// Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping

try {

String result = instance.doOCR(imageFile);

System.out.println(result);

} catch (TesseractException e) {

System.err.println(e.getMessage());

}

}}

I added a VM argument such as jna.library.path=${pathtodll2} and get the below error if I use the argument,

Error: Could not find or load main class jna.library.path=D:\OCR\Tess4J\lib\win32-x86

I'm using the latest version from the Test4J project,

Version 2.0 (29 March 2015)

- Upgrade to Tesseract 3.03 (r1050), which is compatible with Tesseract 3.03RC on Linux

- Refactor Tesseract class for extensibility and thread-safety

- Update English language data for Tesseract 3.02

I'm running it on Windows 7, 32 bit machine. Java 7.

When I try using the process Explorer I'm not able to see the dlls getting loaded but I'm not sure since the exception is thrown right away.

解决方案

Visual C++ Redistributable for VS2012 is not enough.

This tool: http://www.dependencywalker.com/ helped me a lot to found the problem.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值