gpt4 book ai didi

java - 无法加载库 'libtesseract302' : The specified module could not be found

转载 作者:行者123 更新时间:2023-11-29 08:59:47 26 4
gpt4 key购买 nike

全部 - 我正在尝试在我的 Java 项目中使用 tess4j。我已按照以下步骤操作 -

  1. 在创建项目时将/dist 和/lib 中的 jar 文件复制为外部 jar 文件。
  2. 将/tessdata 和 libtesseract302.dll 复制到项目根目录,甚至复制到项目的 src 文件夹中。
  3. 下面是代码(sf 中的 tess4j 示例代码)-

    import java.io.File;
    import net.sourceforge.tess4j.*;

    public class ReadingImage {

    public static void main(String[] args) {
    File imageFile = new File("C:\\Documents and Settings\\T9SAUR\\My Documents\\Downloads\\Tess4J-1.1-src\\Tess4J\\eurotext.tif");
    Tesseract instance = Tesseract.getInstance();
    try {
    String result = instance.doOCR(imageFile);
    System.out.println(result);
    } catch (TesseractException e) {
    System.err.println(e.getMessage());
    }
    }
    }

但是我的代码出错了。根据同一主题的另一篇文章,我检查了 JVM 版本(32 位)和 Eclipse 版本(32 位)。请让我知道哪里出错了。

最佳答案

如果您使用 Eclipse 启动,那么您需要指定与 Tesseract jar 关联的 native 库的位置。参见 How to set the java.library.path from Eclipse

关于java - 无法加载库 'libtesseract302' : The specified module could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18200258/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com