You seem to have not specified the fully-qualified class name. You should 
cd to src and run:

java -cp .;...path-to-jars... 
net.sourceforge.tess4j.example.TesseractExample

If possible, use an IDE, such as NetBeans or Eclipse.

On Thursday, December 26, 2013 9:05:44 AM UTC-6, Risto Puusepp wrote:
>
> Hi!
> I am new in Java but decided to give a shot. I have to recognize some 
> areas from image and extract text from that. I understand that Tesseract 
> has those options (define searching area, using something like OnlyNumbers 
> method and training option). I have tried Asprise but it seems that 
> Tesseract is more accurate.
>
> So far I did:
> Downloaded and unpacked files from http://tess4j.sourceforge.net to my PC 
> under *C:\work\java\Tess4J*. I took and example 
> *http://tess4j.sourceforge.net/codesample.html 
> <http://tess4j.sourceforge.net/codesample.html>*, modified a bit and got 
> code:
> package net.sourceforge.tess4j.example;
> import java.io.File;
> import net.sourceforge.tess4j.*;
> public class TesseractExample {
>     public static void main(String[] args) {
>         File imageFile = new File("c:\\work\\java\\pngs\\test1.jpg");
>         Tesseract instance = Tesseract.getInstance(); // JNA Interface 
> Mapping
>         //Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping
>         try {
>             String result = instance.doOCR(imageFile);
>             System.out.println(result);
>         } catch (TesseractException e) {
>             System.err.println(e.getMessage());
>         }
>     }
> }
> Files:
>  Directory of C:\work\java\Tess4J\src\net\sourceforge\tess4j\example
>
> 17.12.2013  20:08    <DIR>          .
> 17.12.2013  20:08    <DIR>          ..
> 17.12.2013  20:06               197 tess1.bat
> 17.12.2013  20:08               191 tess11.bat
> 26.12.2013  16:47               920 TesseractExample.class
> 17.12.2013  19:44               622 TesseractExample.java
>                4 File(s)          1 930 bytes
>                2 Dir(s)  73 354 510 336 bytes free
>
> C:\work\java\Tess4J\src\net\sourceforge\tess4j\example>
>
>
> It compiles without errors:
> C:\work\java\Tess4J\src\net\sourceforge\tess4j\example>javac -cp .;
> ..\..\..\..\..\lib\ghost4j-0.3.1.jar;
> ..\..\..\..\..\lib\jai_imageio.jar;
> ..\..\..\..\..\lib\jna.jar;
> ..\..\..\..\..\lib\junit-4.10.jar;
> ..\..\..\..\..\dist\tess4j.jar
>  TesseractExample.java
>
> But when I  am going to execute then:
> C:\work\java\Tess4J\src\net\sourceforge\tess4j\example>java -cp .;
> ..\..\..\..\..\lib\ghost4j-0.3.1.jar;
> ..\..\..\..\..\lib\jai_imageio.jar;
> ..\..\..\..\..\lib\jna.jar;
> ..\..\..\..\..\lib\junit-4.10.jar;
> ..\..\..\..\..\dist\tess4j.jar 
> TesseractExample
>
> Exception in thread "main" java.lang.NoClassDefFoundError: 
> TesseractExample (wrong name: net/sourceforge/tess4j/example/
> TesseractExample)
>         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.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 sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
>
> C:\work\java\Tess4J\src\net\sourceforge\tess4j\example>
>
> Am I missing some files or is the structure of files not correct???
>
>
>
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to