Unable to load library 'tesseract': libtesseract.so: cannot open shared object file: No such file or directory

此生再无相见时 提交于 2020-05-25 07:16:46

问题


I've had tesseract and Tess4J running on my MBP for a while now. Today I started to migrate my app to the server and started installing everything on the server. Prior to running Tess4J in tomcat I tried to run a simple java program to make sure everything is fine and dandy. It's not...

  • I'm on a centOS 64bit server
  • I've installed tesseract and its working fine - tesseract myimage.jpg mytext produces data

However, running my simple class that useses Tess4j produces this error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'tesseract': libtesseract.so: cannot open shared object file: No such file or directory

What I've done so far

  • I've ran sudo ldconfig after installing tesseract
  • I've search for libtesseract.so and its found in /usr/local/lib/libtesseract.so

Folder on server contains these files:

myimge.png  
ghost4j-0.3.1.jar  
jai_imageio.jar  
jna.jar  
maslab.jar  
pngj.jar  
tess4j.jar  
TesseractExample.class  
TesseractExample.java

tesseract -v produces:

tesseract -v
tesseract 3.02.02
 leptonica-1.69
  libjpeg 6b : libpng 1.2.49 : libtiff 3.9.4 : zlib 1.2.3

Question

How can I make Tess4J aware that libtesseract.so does exist?enter code here


回答1:


I had this problem too.

Did you run the following after installing tesseract:

sudo ldconfig

That fixed it for me.




回答2:


You must set LD_LIBRARY_PATH environment variable to the path where libtesseract.so is.

export LD_LIBRARY_PATH=/usr/local/lib



回答3:


It is necessary to define the variable jna.platform.library.path. For instance:

-Djna.platform.library.path=/usr/local/lib/




回答4:


Maybe it is a 32 bit library .so installed.



来源:https://stackoverflow.com/questions/15307168/unable-to-load-library-tesseract-libtesseract-so-cannot-open-shared-object-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!