1安装C++运行库
2设置环境变量
TESSDATA_PREFIX
F:\tessdata
3依赖

<dependency>
             <groupId>net.sourceforge.tess4j</groupId>
             <artifactId>tess4j</artifactId>
             <version>4.4.0</version>
 </dependency>


4代码

package com.bootdo;
import net.sourceforge.tess4j.ITesseract;
 import net.sourceforge.tess4j.Tesseract;
 import java.io.File;public class Test1 {
     public static void main(String[] args) {        ITesseract instance = new Tesseract();
         //instance.setDatapath("F://tessdata");
         instance.setLanguage("chi_sim");
         //设置训练库的位置
         String result = null;
         try {
             //result=instance.doOCR(FileUtils.toFile(new URL("http://39.104.78.97:8085/files/7.jpg")));
             result =  instance.doOCR(new File("e:\\logo.png"));
             System.out.println(result);
         } catch (Exception e) {
             e.printStackTrace();
         }    }
 }