4

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

JM12
  • 43
  • 1
  • 1
  • 3

6 Answers6

8

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.

Yuliia Ashomok
  • 8,336
  • 2
  • 60
  • 69
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

Ankit Sharma
  • 1,569
  • 3
  • 19
  • 31
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.

nguyenq
  • 8,212
  • 1
  • 16
  • 16
  • Thanks for you answer, Any how i downloaded the tesseract.so file. But still it is asking some more .so files even i included leptonica libraries it is still asking for for some .so files like libz.so file. Is it problem with jvm version. Iam using 64-bit jvm. Please help – JM12 Aug 29 '13 at 15:07
  • Leptonica has several [dependencies](http://www.leptonica.org/vs2008doc/building-image-libraries.html). Both Tesseract and Leptonica are 32-bit libraries. They cannot be used in a 64-bit JVM. – nguyenq Aug 30 '13 at 03:06
  • Now I am trying to build the tesseract using cygwin in windows I am able to built it, but it is not creating .so files, only ".o" files and ".la" files are created. Please help me how to get ".SO" files using cygwin. Thanks in advance – JM12 Sep 04 '13 at 16:01
  • the way to install tesseract on linux is very confusing, I think the tesseract project would benefit from having more clear ways of getting tesseract / its dependencies. The [details here](https://code.google.com/p/tesseract-ocr/wiki/Compiling) require a fair amount of ops experience, and depend on apt-get – Don Cheadle Oct 26 '14 at 22:00
  • *and for people using Red Hat (main one on Amazon Web Services), apt-get is not available – Don Cheadle Oct 26 '14 at 22:13
0

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

R.Moeller
  • 3,436
  • 1
  • 17
  • 12
  • Thanks for your reply. But in eclipse windows i did not find the libtesseract.so file in any where. So by setting -Djava.library.path in linux can i able to get "libtesseract.so". – JM12 Aug 24 '13 at 15:39
0

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

Tex
  • 305
  • 2
  • 16
0

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.