The Techies' pub

How to use the Tesseract API (to perform OCR) in your java code

I have been working on a small app recently which reads an image and converts it into text using optical character recognition. I have been doing some research on the internet for APIs to do this and found this free OCR API – tesseract.

I tried to follow the instructions therein to use it in my java code and trust me guys it took me almost 3 hours to get my code functional. So, I decided to help out ppl with a similar interest (or similar problem) and I am posting this to help you out.

I have made a video of all these steps given below. (Please read the steps once to get a basic idea).

Step 1:

You will need a JNA wrapper to use tesseract in your java project. I have used tess4j for this. It can be downloaded from here http://tess4j.sourceforge.net/

Step 2:

Now extract the contents of the tess4j archive to your desktop or any other location.

Step 3:

Open netbeans and then click on open project –> navigate to the place where you extracted the tess4j archive and then choose tess4j project. Now you should see the tess4j project in your projects tab as shown below.

Step 4:

Now open a new Java project in your netbeans and type the below code.

Java

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

package<pkgname>;

importjava.io.*;

importnet.sourceforge.tess4j.*;

publicclassMain{

publicstaticvoidmain(String[]args){

File imageFile=newFile("<path of your image>");

Tesseract instance=Tesseract.getInstance();//

try{

Stringresult=instance.doOCR(imageFile);

System.out.println(result);

}catch(TesseractExceptione){

System.err.println(e.getMessage());

}

}

}

and save the file.

Step 5:

Now expand the tess4j project (click on the + sign before it) and expand source packages; inside you will find 3 packages. Copy all of them into your project’s source packages. It should now look like as shown below.

Here ocr is the name of the project I created.

Step 6:

Now right click on libraries and choose add JAR\Folder as shown below:

Navigate to the location where you extracted the tess4j archive. Open the folder (Tess4j) and navigate to lib. There you will see 4 jar files. Choose all of them and click open. Your libraries folder should look like as shown below now.

Step 7:

Phew… Almost there. Now you will find 2 dll files in the Tess4j folder (The folder which you extracted) namely liblept168.dll and libtesseract302.dll. Copy these two files into the net.sourceforge.tess4j package and it should now look like as shown below.

Thats it…!!! Run your code and it should display the text in your image in the output console window (usually present at the bottom if you use netbeans).

You could also write the text into a file or do other manipulations with the text obtained from the image.

If you are stuck inbetween or couldn’t follow any step in this post feel free to drop a comment and I will help you out.. Peace..

at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1759)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.TessAPI.(TessAPI.java:38)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:286)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:222)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:173)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:158)
at javaapplication.JavaApplication.main(JavaApplication.java:19)
Java Result: 1

chetan

I keep getting this error as well, can someone please tell me how to solve this?

karmadip

i found same error:
Exception in thread “main” java.lang.UnsatisfiedLinkError: %1

could some one please help??

Ashish

Hi ,
Can I get any jar so that it can support other language like Hindi Chines .

haythem

Hey

if u have a problem
u have to install jdk1.8 32bit and add it in netbeans

thnx u

chester

Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at net.sourceforge.tess4j.Tesseract.init(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at com.testocr.TessTrial.main(TessTrial.java:19)

Greate pieces. Keep posting such kind of information on your page.
Im really impressed by it.
Hey there, You have done a great job. I’ll certainly digg it and in my opinion suggest to my friends.
I am sure they’ll be benefited from this web site.

Divya

Hi,

I’m implementing it in Web application, but has some error
java.lang.IllegalStateException: Input not set
at com.sun.imageio.plugins.jpeg.JPEGImageReader.getNumImages(JPEGImageReader.java:357)
at com.pumex.FRACTS.DataEntry.dao.ImageIOHelper.getIIOImageList(ImageIOHelper.java:298)
at com.pumex.FRACTS.DataEntry.dao.Tesseract.doOCR(Tesseract.java:172)
at com.pumex.FRACTS.DataEntry.dao.Tesseract.doOCR(Tesseract.java:157)
at com.pumex.FRACTS.DataEntry.controller.DEController.getDataEntryCrop(DEController.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

Divya

Hi,
Please help, I want to know how the dll works in Java Web application. UnsatisfiedLinkError occur

ajinkya

hii i got same error..
have you solve it…?????

abc

Exception in thread “main” java.lang.Error: Invalid memory access
at com.sun.jna.Native.invokePointer(Native Method)
at com.sun.jna.Function.invokePointer(Function.java:470)
at com.sun.jna.Function.invoke(Function.java:404)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at com.sun.proxy.$Proxy0.TessBaseAPIGetUTF8Text(Unknown Source)
at net.sourceforge.tess4j.Tesseract.getOCRText(Tesseract.java:336)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:232)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:173)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:158)
at com.ocr.Main.main(Main.java:15)

kevin

Apr 18, 2014 10:38:07 PM net.sourceforge.tess4j.Tesseract doOCR
SEVERE: Input not set
java.lang.IllegalStateException: Input not set
at com.sun.imageio.plugins.jpeg.JPEGImageReader.getNumImagesOnThread(JPEGImageReader.java:396)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.getNumImages(JPEGImageReader.java:384)
at net.sourceforge.vietocr.ImageIOHelper.getIIOImageList(ImageIOHelper.java:298)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:176)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:160)
at ocrtest.OCRTest.main(OCRTest.java:15)

Hello,
I have tried to install it on my PC with Eclipse and I have the following error:
Exception in thread “main” java.lang.UnsatisfiedLinkError: %1 n’est pas une application Win32 valide
I tried a lot of different solutions but I cannot succeed. Could you help me? Thank you

admin

Sure Jack.. Could you please let me know which version of eclipse you tried to install..?

POOJA

I am getting this error. Can u please help me to resolve this error ???

Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘libtesseract302’: Native library (win32-x86-64/libtesseract302.dll) not found in resource path ([file:/C:/Users/POOJA/Desktop/Tess4J/lib/ghost4j-0.5.1.jar, file:/C:/Users/POOJA/Desktop/Tess4J/lib/jai_imageio.jar, file:/C:/Users/POOJA/Desktop/Tess4J/lib/jna-4.1.0.jar, file:/C:/Users/POOJA/Desktop/Tess4J/lib/junit-4.10.jar, file:/C:/Users/POOJA/Desktop/Tess4J/lib/log4j-1.2.17.jar, file:/C:/Users/POOJA/Desktop/JavaApplication3/build/classes/])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.TessAPI.(TessAPI.java:38)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:278)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:214)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:165)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:150)
at javaapplication3.JavaApplication3.main(JavaApplication3.java:27)
Java Result: 1

Shubhangi Shinde

U have add library file of tess4j.It will get on SourceForge.net

Shubhangi Shinde

Also copy the libtesseract302.dll ,liblept168.dll file in your project.

very nice tutorial ………thank you so much,,,,,,,….please give me code for a crop and retrieve text from a particular rectangle…
please reply me fast…….

thanxxx…

Sunil

HI Admin,

Thank you very much Dude you did a splendid work.

I want use my own trained tessdata file inside the code. Can you pls tell me that how to use tessdata folder iside the code?

admin

Sir, I don’t understand what you meant by trained tessdata file. Could you please elaborate? (You could drop me a mail and I would be glad to help you)

admin

Hi Everyone,
I am really sorry for taking so much time to respond to your queries. I could see that a lot of ppl are trying this up with eclipse. I will soon post the same. Thank you.

Reshu

Hi,

I tried your steps but I got error which was showing that it needed some libtesseract.so file which was not in my system and my system is 64 bit. When I googled it this is showing system’s bit size problem. How can I get this libtesseract.so file and how can I use this?

prathi

hi,
i am getting this exception. pls help me. thanku.

net.sourceforge.tess4j.Tesseract doOCR
SEVERE: No input source set!
java.lang.IllegalStateException: No input source set!
at com.sun.imageio.plugins.png.PNGImageReader.getNumImages(PNGImageReader.java:1318)
at net.sourceforge.vietocr.ImageIOHelper.getIIOImageList(ImageIOHelper.java:297)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:165)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:150)
at ocr.Main.main(Main.java:21)

I am getting following error Can anybody help?
SEVERE: Error looking up function ‘gsapi_new_instance’: The specified procedure could not be found.

wirher

OMG! You saved me sooooo much time! Thank you for this entry, thank you!

Bimla Madhavee

Can you please help me with the above program? Although I worked according to the above steps I get a runtime error which is
Exception in thread “main” java.lang.UnsatisfiedLinkError: The specified module could not be found.

at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:263)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:403)
at com.sun.jna.Library$Handler.(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:502)
at com.sun.jna.Native.loadLibrary(Native.java:481)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(Unknown Source)
at net.sourceforge.tess4j.TessAPI.(Unknown Source)
at net.sourceforge.tess4j.Tesseract.init(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at tesseractexample.TesseractExample.main(TesseractExample.java:22)
Java Result: 1
I don’t know how to correct it. Thank you in advance

Matheus

Hello, i tried using your tutorial with NetBeans and got stuck with “Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘libtesseract302’ ” it seems that this problem is caused by the usage of 32 bits dll in a 64bits jvm. However i can’t pass this. I also tried using the 64 bits of the dlls but nothing worked

Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘libtesseract302’: Native library (win32-x86/libtesseract302.dll) not found in resource path ([file:/C:/Tess4J/lib/commons-io-2.4.jar, file:/C:/Tess4J/lib/ghost4j-0.5.1.jar, file:/C:/Tess4J/lib/jai_imageio.jar, file:/C:/Tess4J/lib/jna-4.1.0.jar, file:/C:/Tess4J/lib/junit-4.10.jar, file:/C:/Tess4J/lib/log4j-1.2.17.jar, file:/C:/Tess4J/build/classes/, file:/C:/Users/admin/Documents/NetBeansProjects/TesseractExample/build/classes/])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:78)
at net.sourceforge.tess4j.TessAPI.(TessAPI.java:33)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:303)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:239)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:188)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:172)
at tesseractexample.TesseractExample.main(TesseractExample.java:23)

Yaz

Error :SEVERE: Couldn’t seek!
javax.imageio.IIOException: Couldn’t seek!
at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.locateImage(TIFFImageReader.java:256)
at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.getNumImages(TIFFImageReader.java:279)
at net.sourceforge.vietocr.ImageIOHelper.getIIOImageList(ImageIOHelper.java:331)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:188)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:172)
at Test.main(Test.java:11)
Caused by: java.io.EOFException
at javax.imageio.stream.ImageInputStreamImpl.readShort(Unknown Source)
at javax.imageio.stream.ImageInputStreamImpl.readUnsignedShort(Unknown Source)
at com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.locateImage(TIFFImageReader.java:243)

When doing OCR for multiple language in the same file where to put tessdata input for multiple languages ?

Parth Anjaria

Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘libtesseract302’: Native library (win32-x86-64/libtesseract302.dll) not found in resource path ([file:/F:/ocr/Tess4J/lib/ghost4j-0.5.1.jar, file:/F:/ocr/Tess4J/lib/jai_imageio.jar, file:/F:/ocr/Tess4J/lib/jna-4.1.0.jar, file:/F:/ocr/Tess4J/lib/junit-4.10.jar, file:/F:/ocr/Tess4J/lib/commons-io-2.4.jar, file:/F:/null/ocr/build/classes/])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:271)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:78)
at net.sourceforge.tess4j.TessAPI.(TessAPI.java:33)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:303)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:239)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:188)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:172)
at ocr.Main.main(Main.java:24)

i am getting this error..
cant find any solution to it. please help me admin.
i need to give the project asap

Parth Anjaria

getting the following error, please reply asap, i need it in my project:

Exception in thread “main” java.lang.UnsatisfiedLinkError: The specified module could not be found.

at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1759)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(Unknown Source)
at net.sourceforge.tess4j.TessAPI.(Unknown Source)
at net.sourceforge.tess4j.Tesseract.init(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at tess4j.TesseractExample.main(TesseractExample.java:27)
Java Result: 1
BUILD SUCCESSFUL (total time: 8 seconds)

Parth Anjaria

dude can u help me im getting the same error

Atdhe Muhaxhiri

I’v tried in mac OS X but w/o lack. After going through your step I have this error:
run:
Mar 20, 2015 7:11:05 PM net.sourceforge.tess4j.Tesseract doOCR
SEVERE: Input not set
java.lang.IllegalStateException: Input not set
at com.sun.imageio.plugins.jpeg.JPEGImageReader.getNumImagesOnThread(JPEGImageReader.java:401)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.getNumImages(JPEGImageReader.java:389)
at net.sourceforge.vietocr.ImageIOHelper.getIIOImageList(ImageIOHelper.java:331)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:188)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:172)
at testtess4j.TestTess4J.main(TestTess4J.java:25)

I have done setup on my linux machine can you please help me out alternatives for dll cause im getting error as
Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘tesseract’:

at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:78)
at net.sourceforge.tess4j.TessAPI.(TessAPI.java:40)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:360)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:273)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:205)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:189)
at tess4j.example.TesseractExample.main(TesseractExample.java:22)
Java Result: 1

for ‘Exception in thread “main” java.lang.UnsatisfiedLinkError: ‘
1 ) Go to ‘http://tess4j.sourceforge.net/usage.html’ click on -“Visual C++ Redistributable for VS2012 ” donwload it and run (VSU_4\vcredist_x64.exe or VSU_4\vcredist_x84.exe depending upon your system configuration )
2 put your dll files inside lib folder along with your libraries (ex \lib\win32-x86\your dll files)
3 tessdata folder is imp one so kept it along with src ,lib folders
now it will work .
Thank you

pooja

i have downloaded tesseract 3.02 …which other files do i have to download ? i am doing a project based on OCR

I am getting this warning whenever i run the project.Can you please help me out to solve it asap.it’s very urgent..

Exception in thread “main” java.lang.UnsatisfiedLinkError: The specified module could not be found.

at com.sun.jna.Native.open(Native Method)

at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:263)

at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:403)

at com.sun.jna.Library$Handler.(Library.java:147)

at com.sun.jna.Native.loadLibrary(Native.java:502)

at com.sun.jna.Native.loadLibrary(Native.java:481)

at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(Unknown Source)

at net.sourceforge.tess4j.TessAPI.(Unknown Source)

at net.sourceforge.tess4j.Tesseract.init(Unknown Source)

at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)

at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)

at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)

at tess4j.example.Tessaracttest.main(Tessaracttest.java:27)

Java Result: 1

BUILD SUCCESSFUL (total time: 0 seconds)

Ajinkya Badwe

please insert tess4j path in project.. see my last comment below.

radhikadevi muthyala

I am getting this warning whenever i run the project.Can you please help me out to solve it asap.it’s very urgent.

java.lang.UnsatisfiedLinkError: The specified module could not be found.

at com.sun.jna.Native.open(Native Method)

at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:263)

at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:403)

at com.sun.jna.Library$Handler.(Library.java:147)

at com.sun.jna.Native.loadLibrary(Native.java:502)

at com.sun.jna.Native.loadLibrary(Native.java:481)

at Tess4j.Tessaracttest.(Tessaracttest.java:33)

Exception in thread “main” Java Result: 1

admin

The unsatisfied link error usually occurs when there is a mismatch in the jdk/jre installed and the tesseract libs you use. Please google and download the 64-bit libraries and try the same method again.

Safaa Al-Husban

I am getting this warning whenever i run the project.Can you please help me out to solve it
Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘libtesseract302’: The specified module could not be found.

can you please tell me where these line should be written in my code any specific class or some thing?

Aditya

Hi @disqus_XrwtjzvgNs:disqus ,
i’m making an app for Japanese language and i’m using Tesseract with javacpp instead of tess4j
my application is able to load trained data but output is coming as a junk charecters
this is my init configuration: (api.Init(“.”, “jPN”) != 0)
could you help me in setting up tesseract to produce proper output

I did exactly as described, but there are many errors while compiling. See the image attached. Most of the errors are due to unavailability of dependencies from lept4l (atleast that’s what I think). Please help me, my work is stuck. I uploaded multiple screenshots to imgur, here’s the link. http://imgur.com/a/aiOAR

Nikhil Khandelwal

Barcode recognition is possible in Tess4j?? If possible then how to do it please suggest

Anant Mahale

the .jar file of project not working.

Anil Kumar

this is not working on windows 10 64bit
please help me

Jayant Kumar

hii, i did same steps as explained above, but while running this project , i’m getting this error ,

Exception in thread “main” java.lang.UnsatisfiedLinkError: The specified module could not be found.

at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1759)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:77)
at net.sourceforge.tess4j.TessAPI.(TessAPI.java:42)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:367)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:280)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:212)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:196)
at homw.main(homw.java:22)
Java Result: 1

Srilakshmi Yadav

i dint get the dll scrits to copy wt to do?

Ta

I can’t find liblept168.dll and libtesseract302.dll. I downloaded Tess4J 3.3.1

at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1759)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:81)
at net.sourceforge.tess4j.TessAPI.(TessAPI.java:42)
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:367)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:280)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:212)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:196)
at Main.main(Main.java:11)
C:UsersAdministradorAppDataLocalNetBeansCache8.2executor-snippetsrun.xml:53: Java returned: 1
BUILD FAILED (total time: 11 seconds)