JM12
JM12

Reputation: 43

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

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

Upvotes: 4

Views: 12528

Answers (6)

ruturaj powar
ruturaj powar

Reputation: 5

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.

Upvotes: 0

Yuliia Ashomok
Yuliia Ashomok

Reputation: 8598

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.

Upvotes: 9

Ankit Sharma
Ankit Sharma

Reputation: 1565

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

Upvotes: 3

Tex
Tex

Reputation: 305

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

Upvotes: 0

nguyenq
nguyenq

Reputation: 8345

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.

Upvotes: 1

R.Moeller
R.Moeller

Reputation: 3446

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

Upvotes: 0

Related Questions