Including Tess4J to a Java project as library in Eclipse

15,610

Follow the steps described in the following link to get Tess4J to run in Eclipse:

http://sourceforge.net/projects/tess4j/forums/forum/1202294/topic/4506433

I'm not sure the library would run on Android because it seems JNA support on the platform is not there yet.

If you want a .NET wrapper for Tesseract 3.01, take a look at https://github.com/charlesw/tesseract-ocr-dotnet.

Share:
15,610
sschrass
Author by

sschrass

Likes Android, likes REST and likes to get more in touch with both. Convinced that HTML5 is a bad thing for apps, but cool for websites. Plays League Of Legends on a regular basis and --of course Quake.

Updated on July 08, 2022

Comments

  • sschrass
    sschrass almost 2 years

    I have an so far empty and clean Eclipse Java project. What do I have to do to use Tess4J as library for my web service that I want to develop? Is it even possible to use it as library for an Android project? (would be shortcutting a lot) There is an issue regarding .tif with android that I came across.

    Tess4J is a wrapper for native code, because tesseract-ocr is written in C/C++. That I've got so far. But how to include this wrapper into my project?

    I've googled a lot until I have decided to drop tesseract.Net, beacuse this project is badly maintained/documented and would force me to C# (which would be okay), but I didn't manage to get it to work, so I had to default to C/C++ (which is not okay) ;)

    I'm kind of lost right now, so any help is welcome. regards.

    Edit: followed the steps mentioned here (answer from nguyenq)

    1: new Eclipse workspace

    2: created a new dir called lib

    3: copied \Tess4J\dist\tess4j.jar, \Tess4J\lib\jna.jar and \Tess4J\lib\jai_imageio.jar into lib (2)

    4: created a new Java project in Eclipse

    5: in project properties (4) I added the .jars from (3) to Java build path as external jars under libraries

    6: I copied the dir \tessdata and libtesseract302.dll into the project root dir \workspace\project\

    7: I created a new class Main and instantiated a Tesseract1 tesseract = new Tesseract1(); for testing

    8: I run the application but an Exception was thrown: Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'libtesseract302' Module not found

    Edit2:

    7.1: I created a new class Main and instantiated a Tesseract tesseract = new Tesseract.getInstance(); for testing (source: here)

    8.1: looked okay so far, but no logic implemented, just tried to build it.

    Edit3:

    9: nope, doesn't work. Still UnsatisfiedLinkError. Could it may be an issue regarding 32-bit vs. 64-bit? I'am working on Win7 64bit.