Closed ralphcook closed 2 years ago
I have chased the problem down further; Java 17 does not have the com.sun.jna package included in the java runtime, though Java 8 does. Therefore Tess4j fails because it needs com.sun.jna.Native and com.sun.jna.Platform. I tried adding a dependency to the net.java.dev.jna, which is what is given for this package. This did put the jna-5.12.1.jar in the Maven dependencies and in the application jar, but the command-line invocation on that jar still fails the same way.
It turns out I had an improper build of my jar file; once I fixed that, compiling my application for Java 8 enabled it to run on a later version. User error.
I use Tess4j in a Java desktop app running on Windows 10. I provide the app for free for organizations working with poor people trying to get their driving licenses restored. It's been working fine with Java 8.
Now I'm trying to get it to work with more recent versions of Java, and it fails when making the doOCR call. I've written two classes that illustrate the problem:
and:
I use Maven to get the 5.4 version of Tess4j, here is the pom.xml:
I have Tesseract-OCR v5.2.0.20220712 installed on the machine where this test is run.
When I run the program in eclipse, configured to use the Java 17 runtime, I get the following output:
When I run the program from a Windows CMD line on the same machine, from a Runnable Jar exported from the same eclipse project, I get the following:
If I uninstall Java 17 and install Java 8, things work as expected.
Am I doing something wrong? Is Tess4j not supported for Java versions past 8, or for Windows 10?
PDFTextReader.java.txt TTest.java.txt