Tess4j发出java.lang.UnsatisfiedLinkError

时间:2014-06-12 12:44:49

标签: java ocr

我试图解决Tess4J安装问题,
1我在WEB-INF \ win32-x86中创建了一个文件夹 2,我把libtesseract302.dll和liblept168.dll推到那里,我把它添加到java构建路径中的源/本机库 我跑的时候发现了错误

java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract302': Native library (win32-x86/libtesseract302.dll) not found in resource path ([file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/classes/, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/ghost4j-0.5.1.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/jai_imageio.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/jna-4.1.0.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/junit-4.10.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/log4j-1.2.17.jar, file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/wtpwebapps/OCR/WEB-INF/lib/tess4j.jar])
com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271)
com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
com.sun.jna.Library$Handler.<init>(Library.java:147)
com.sun.jna.Native.loadLibrary(Native.java:412)
com.sun.jna.Native.loadLibrary(Native.java:391)
net.sourceforge.tess4j.TessAPI.<clinit>(Unknown Source)
net.sourceforge.tess4j.Tesseract.init(Unknown Source)
net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
ocrTest.doGet(ocrTest.java:39)
javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

注意我已经检查过我使用32 jvm和

System.out.println(System.getProperty("sun.arch.data.model"));

所以我确定 的问题
如何解决这个错误?
如果我在设置tess4j时出错,请告诉我怎么做?

1 个答案:

答案 0 :(得分:2)

我找到了解决方案
1 here下载tesseract-ocr-setup-3.02.02.exe并安装 2 添加ghost4j-0.5.1.jarjai_imageio.jarjna-4.1.0.jarjunit-4.10.jarlog4j-1.2.17.jartess4j.jar以投影构建路径
并享受;)