java tesseract error in linux “Unable to load library 'tesseract': libtesseract.so”

青春壹個敷衍的年華 提交于 2021-02-18 17:49:55

问题


I am using tess4J ocr library in eclipse and is working fine in my windows. But when i want to run that java program in linux it is giving an error "Unable to load library 'tesseract': libtesseract.so: cannot open shared object file: No such file or directory".

I dont have any permissions on linux to install the tesseract or any other software . Just i can use the jar files and run the java program by calling the shell script.Please help me on this . As I am thinking my problem will be solved by getting libtesseract.so file or help me how to get libtesseract.so in windows so that i will use that in linux . Please help and thank in advance


回答1:


On Linux, Tess4J calls on Tesseract native library libtesseract.so to work. If you can't build or install Tesseract on Linux, you're in tough luck. Maybe if you can cross-compile to a .so on Windows using Cygwin or Mingw.




回答2:


It is enough to install Tesseract for Linux using command:

sudo apt-get install tesseract-ocr

now you can check tesseract version, using command:

tesseract -v

Please note, that for Tesseract 3.03 you can use Tess4j version 2.0. Another version may give you errors because of incompatibility.

You can get more info about different version compatibility in Change Log, or here.




回答3:


In My case (centos) I copied all the files (having lept or teesseract keyword in file name) from folder

/usr/local/lib

to folder

/usr/lib64

and it solved my problem




回答4:


You have to set -Djava.library.path so the file can be found or tweak your standard library path to include the location of the .so in .bashrc by extending system's LD_LIBRARY_PATH




回答5:


You need to install without root and specify the path of your libtesseract.so

Install elsewhere / without root

Tesseract can be configured to install anywhere, which makes it possible to install it without root access.

To install it in $HOME/local:

./autogen.sh

./configure --prefix=$HOME/local/

make install

To install it in $HOME/local using Leptonica libraries also installed in $HOME/local:

./autogen.sh

LIBLEPT_HEADERSDIR=$HOME/local/include ./configure \ --prefix=$HOME/local/ --with-extra-libraries=$HOME/local/lib

make install




回答6:


I also had same problem. Tesseract libraries was aslo present under /usr/local/lib directory.Still I was getting this error. Actually this is linking problem. so you have to provide the /usr/local/lib path to the resolver path in the /etc/ld.so.conf.d/libc.conf file. make entry of path in this file or you can create any new conf file in the same dir.



来源:https://stackoverflow.com/questions/18419504/java-tesseract-error-in-linux-unable-to-load-library-tesseract-libtesseract

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