I am trying to use Tesseract to have OCR functionality in a Java application. To achieve this, I am using the Java/Tesseract bridge found here.
pom.xml
dependency:
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>tesseract</artifactId>
<version>3.04-1.1</version>
</dependency>
It works, I can use the library to OCRize an image. But when the Java program finishes, the JVM crashes. For a minimal example, even the very first Tesseract initialization line is enough:
import org.bytedeco.javacpp.tesseract.TessBaseAPI;
public class MinimalExample {
public static void main(String[] args) {
System.out.println("Hi!");
TessBaseAPI tessAPI = new TessBaseAPI();
}
}
If I run this main
, it gives the following:
Hi!
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
And the following error message: Java(TM) Platform SE binary funktioniert nicht mehr – Windows kann online nach einer Lösung für das Problem suchen.
(Java(TM) Platform SE binary does not work anymore – Windows can look for a solution to this problem online
).
Problemsignatur:
Problemereignisname: APPCRASH
Anwendungsname: java.exe
Anwendungsversion: 8.0.650.17
Anwendungszeitstempel: 5614685f
Fehlermodulname: libgcc_s_dw2-1.dll
Fehlermodulversion: 0.0.0.0
Fehlermodulzeitstempel: 3f263ec2
Ausnahmecode: 40000015
Ausnahmeoffset: 000149a1
Betriebsystemversion: 6.1.7601.2.1.0.256.49
Gebietsschema-ID: 1031
Zusatzinformation 1: 7309
Zusatzinformation 2: 73092f5dbc78923c702ae5601110d2ea
Zusatzinformation 3: 9fa1
Zusatzinformation 4: 9fa11625863fb37077a4ab55be352b96
I've never had Java crashing before – but I've also never used natives before. ;-) Does anybody have a hint where to look for a solution to this strange behaviour?
Edit 2015-12-07: Using ListDLLs, I've seen that the DLL in question is located in C:\Users\...\AppData\Local\Temp\javacpp3256864312633\libgcc_s_dw2-1.dll
, so "Wrong DLL from %PATH%
" is not the answer.
libgcc_s_dw2-1.dll
with the newest version from MSYS2 might also work. – Samuel AudetSamiel Audet == saudet
! ;) How could I replace the dll? It lies in a jar that is loaded by Maven, I do not know how I should interfere with that process without sacrifying the whole Maven process benefit. – Kurtibert