Search code examples
javalinuxtomcattesseracttess4j

Tesseract redhat tomcat 8 config - TessApi classdefnotfound


Tesseract run successfully in eclipse, windows 7, Tomcat 8

When I run the same application on linux machine(RHEL)+java 8+tomcat 8 I get classdefnotfound error. The class is present (TessAPI.class) in classes folder.

I did this to setup in linux.

tar xzf tomcat8.0.37.tar.gz
sudo yum install libpng-devel libjpeg-devel
sudo yum install libtiff
sudo yum install automake
sudo yum install libtool

yum install apr-devel openssl-devel
rpm -ivh jdk-8u101-linux-x64.rpm

tar xzf leptonica-1.69.tar.gz  <- download this
cd /tmp/leptonica-1.69 
./configure
make
sudo make install

tar xzf tesseract-ocr-3.02.02.tar.gz  <- download this
cd tesseract-ocr
./autogen.sh
./configure
make 
sudo make install

yum groupinstall "Development Tools"

source /etc/profile
sudo ldconfig
export LD_LIBRARY_PATH=/usr/local/lib

Am I missing something here?


Solution

  • After spending much time I successfully completed OCR integration with Red Hat linux, with all the steps above and below is additional step I have done, might be helpful for someone in near future :)

    Added(created new file with name "setenv.sh" in tomcat_home/bin)

    Add these lines

    JRE_HOME=/usr/java/jdk1.8.0_101/jre 
    

    <-- this line as my default jre was 1.7

    LD_LIBRARY_PATH=/usr/local/lib/:/usr/local/apr/lib:$CATALINA_HOME/lib 
    

    <-- /usr/local/lib location tesseract .so available

    export LD_LIBRARY_PATH