【发布时间】:2018-12-20 19:15:29
【问题描述】:
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>3.2.1</version>
</dependency>
我在 maven 中使用上述依赖项。 这用于java和eclipse。
我现在正在编译成一个可执行 jar,它在 windows 中执行时没有任何错误,因为我在 windows 中安装了“Visual C++ Redistributable Packages for Visual Studio 2013”。
但现在我想在 linux 机器上运行可执行 jar。我收到以下错误:
错误 net.sourceforge.tess4j.Tesseract - 无法加载库“gs”:在资源路径([file:/MedEq/OCR/dme-ocr)中找不到本机库(linux-x86-64/libgs.so) -0.0.1-SNAPSHOT-jar-with-dependencies.jar]) 请从http://sourceforge.net/projects/ghostscript/files 下载、安装 GPL Ghostscript 和/或设置适当的环境变量。 [pool-2-thread-2] 错误 net.sourceforge.tess4j.Tesseract - 无法初始化类 org.ghost4j.GhostscriptLibrary 请从http://sourceforge.net/projects/ghostscript/files 下载、安装 GPL Ghostscript 和/或设置适当的环境变量。 java.lang.RuntimeException:无法加载库“gs”:在资源路径中找不到本机库(linux-x86-64/libgs.so)([file:/OCR/dme-ocr-0.0.1-SNAPSHOT-jar -with-dependencies.jar]) 请从http://sourceforge.net/projects/ghostscript/files 下载、安装 GPL Ghostscript 和/或设置适当的环境变量。 在 net.sourceforge.tess4j.util.PdfUtilities.convertPdf2Tiff(PdfUtilities.java:55) 在 net.sourceforge.tess4j.util.ImageIOHelper.getIIOImageList(ImageIOHelper.java:343) 在 net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:213) 在 net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:197)
【问题讨论】:
-
哪个Linux发行版和版本?哪个java版本?哪个 tess4j 版本?
-
@4F2E4A2E Linux 版本:RedHat Enterprise(Aws ec2 实例) Java 版本:1.7 Tess4j 版本:3.2.1 安装在 RHEL 机器上,leptonica-1.75.3 tesseract-ocr-3.02.02 最新的 GhostScript(因为我做了 yum install Ghostscript)如果这是一个兼容性问题或我应该用 Linux 机器修复的问题,请帮助我。我已经将 jar 与在 windows 中运行的 tess4j 捆绑在一起,但在 Linux 机器上,我无法运行 jar。