nguyenq / tess4j

Java JNA wrapper for Tesseract OCR API
Apache License 2.0
1.58k stars 372 forks source link

Added link to mac library to patch Tess4j on MacOS #246

Open EasyG0ing1 opened 1 year ago

EasyG0ing1 commented 1 year ago

Hello,

I created a library that will help MacOS users patch their tess4j.jar file with the C library that comes with tesseract. This will help developers who wish to use your library on MacOS avoid the frustration of hunting down the error that gets thrown when trying to use this library.

I simply added a link to the README with a brief explanation.

SERE026 commented 10 months ago

Hello, Mac M2 芯片运行报错,目前没有找到解决方案, 在命令行是可以直接识别图片的, java 中不行

Exception in thread "main" java.lang.UnsatisfiedLinkError: dlopen(/Users/apple/IdeaProjects/uds/uds-modules/uds-recognition/target/classes/libtesseract.dylib, 0x0009): tried: '/Users/apple/IdeaProjects/uds/uds-modules/uds-recognition/target/classes/libtesseract.dylib' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/apple/IdeaProjects/uds/uds-modules/uds-recognition/target/classes/libtesseract.dylib' (no such file), '/Users/apple/IdeaProjects/uds/uds-modules/uds-recognition/target/classes/libtesseract.dylib' (not a mach-o file)
    at com.sun.jna.Native.open(Native Method)
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:298)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:483)
    at com.sun.jna.Library$Handler.<init>(Library.java:197)
    at com.sun.jna.Native.load(Native.java:622)
    at com.sun.jna.Native.load(Native.java:596)
    at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:83)
    at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
    at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:442)
    at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:238)
    at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:210)
    at com.uds.parser.OcrReader.main(OcrReader.java:28)

Process finished with exit code 1
EasyG0ing1 commented 8 months ago

@SERE026

Update

The library has been updated, and now there is an executable program that you can get from the releases page on the repo where you can patch your Tess4J jar file easily. The program runs in Terminal and can be downloaded here

The program was compiled into a native-image using GraalVM.

miaozhiyan commented 5 months ago

@SERE026

Update

The library has been updated, and now there is an executable program that you can get from the releases page on the repo where you can patch your Tess4J jar file easily. The program runs in Terminal and can be downloaded here

The program was compiled into a native-image using GraalVM.

错误的类文件: /Users/mzy/.m2/repository/com/simtechdata/FixTess4j4Mac/2.0.0/FixTess4j4Mac-2.0.0.jar!/com/simtechdata/FixTess4j4Mac.class 类文件具有错误的版本 55.0, 应为 52.0

这是怎么回事呀?