How is this supposed to help me? I have a program using the Tesseract
library to do OCR and then process the resulting text; I don't need a GUI
front end.

On Thu, Sep 22, 2022 at 10:09 PM Quan Nguyen <nguyen...@gmail.com> wrote:

> You may want to try VietOCR, a Java desktop app that uses Tess4J. It works
> with Java 8, 18, and probably 11 too.
>
> http://vietocr.sf.net
>
> On Thursday, September 22, 2022 at 7:10:54 AM UTC-5 rcja...@gmail.com
> wrote:
>
>> I am running a Java desktop application on Windows 10 Pro using Tess4j;
>> it was working fine with Java 1.8, am now trying to get it to run with Java
>> 11 (11.0.15.1). When it calls 
>> net.sourceforge.tess4j.Tesseract.doOCR(BufferedImage
>> bi), it gets a Throwable ExceptionInInitializerError, with a 'cause'
>> exception indicating a call to
>> net.sourceforge.tess4j.util.LoadLibs.getTesseractLibName().
>>
>> Oddly enough, the application works fine from within eclipse, but fails
>> running on its own (for instance, running "java -jar program.jar" from a
>> cmd window). As I said, it was running with Java 1.8, and I might be able
>> to get it running again by uninstalling Java and reinstalling that JRE, but
>> there are other people that are going to use the application and it is not
>> reasonable to expect them to use a Java version that is that old.
>>
>> I had the Maven dependency:
>>
>>         <groupId>net.sourceforge.tess4j</groupId>
>>         <artifactId>tess4j</artifactId>
>>         <version>4.4.1</version>
>>
>> The only copy of tess4j-4.1.1.jar on my hard drive is in my
>> .m2\repository\net\sourceforge\tess4j\tess4j\4.4.1. I have twice deleted it
>> and updated my maven configuration to restore it, to insure it is not
>> corrupted.
>>
>> I noticed that this is not the most recent Tess4j, so updated the
>> dependency to 5.4.0 and rebuilt. This has the same results: works in
>> eclipse, not from command line.
>>
>> The ExceptionInInitializerError is caused by an IllegalStateException:
>> zip file closed error. Documentation indicates this could be a corrupted
>> jar file or something similar. I don't know what jar file could be involved
>> except the tess4j, and I've replaced that twice as I've said.
>>
>> I've also tried this with two versions of the Tesseract-OCR dll --
>> 5.0.1.20220118 and v5.2.0.20220712; they were both installed for "anyone on
>> this computer" with default options. They give the same results.
>>
>> Can someone help me figure out what's wrong?
>>
>> Stack trace:
>>
>> java.lang.ExceptionInInitializerError
>>         at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:427)
>>         at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:311)
>>         at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:294)
>>         at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:275)
>>         at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:259)
>>         at
>> drivingrecordtool.file.DrivingRecordPDFTextReader.getOCRText(DrivingRecordPDFTextReader.java:152)
>>         at
>> drivingrecordtool.file.DrivingRecordPDFTextReader.getText(DrivingRecordPDFTextReader.java:46)
>>         at
>> drivingrecordtool.file.DrivingRecordFileReader.doInBackground(DrivingRecordFileReader.java:78)
>>         at
>> drivingrecordtool.file.DrivingRecordFileReader.doInBackground(DrivingRecordFileReader.java:1)
>>         at
>> java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
>>         at
>> java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>         at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
>>         at
>> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>>         at
>> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>>         at java.base/java.lang.Thread.run(Thread.java:834)
>> Caused by: java.lang.IllegalStateException: zip file closed
>>         at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:913)
>>         at java.base/java.util.zip.ZipFile.getEntry(ZipFile.java:348)
>>         at java.base/java.util.zip.ZipFile$1.getEntry(ZipFile.java:1130)
>>         at java.base/java.util.jar.JarFile.getEntry0(JarFile.java:586)
>>         at java.base/java.util.jar.JarFile.getEntry(JarFile.java:516)
>>         at
>> java.base/sun.net.www.protocol.jar.URLJarFile.getEntry(URLJarFile.java:131)
>>         at java.base/java.util.jar.JarFile.getJarEntry(JarFile.java:478)
>>         at
>> java.base/jdk.internal.loader.URLClassPath$JarLoader.getResource(URLClassPath.java:945)
>>         at
>> java.base/jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:315)
>>         at
>> java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:455)
>>         at
>> java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
>>         at java.base/java.security.AccessController.doPrivileged(Native
>> Method)
>>         at
>> java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
>>         at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
>>         at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
>>         at
>> net.sourceforge.tess4j.util.LoadLibs.getTesseractLibName(LoadLibs.java:95)
>>         at
>> net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:85)
>>         at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
>>         ... 15 more
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "tesseract-ocr" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/tesseract-ocr/sk9j5bRLgXw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> tesseract-ocr+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tesseract-ocr/4f8fad3a-a091-4521-9c1b-2dbf747e99f5n%40googlegroups.com
> <https://groups.google.com/d/msgid/tesseract-ocr/4f8fad3a-a091-4521-9c1b-2dbf747e99f5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 tesseract-ocr+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/CAPzR6SZYktupEjR4Q_qSoYN2gDg2d5p2X4gMyaxxRzcsiab7zg%40mail.gmail.com.

Reply via email to