Tess4j issue java.lang.UnsatisfiedLinkError

2019-07-04 11:06发布

问题:

I'm trying to solve the Tess4J installing problem ,
1 I had created a folder in WEB-INF\win32-x86
2 and I putted there the libtesseract302.dll and liblept168.dll and I add it to source/native library in the java build path when I run I found the error

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)

Note I had checked that I'm using 32 jvm with

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

so I'm sure
Questions
how to fix this error ?
if I made an error in setup tess4j please tell me how ?

回答1:

I found the solution
1 download tesseract-ocr-setup-3.02.02.exe from here and install it
2 add the ghost4j-0.5.1.jar,jai_imageio.jar,jna-4.1.0.jar,junit-4.10.jar,log4j-1.2.17.jar and tess4j.jar to project the build path
and Enjoy ;)



标签: java ocr