java.lang.NoClassDefFoundError: net/sourceforge/tess4j/TesseractException
java.lang.NoClassDefFoundError: net/sourceforge/tess4j/TesseractException
我尝试使用 Java 和 Tesseract.I 为 Mirth 做一个 ocr 应用程序,将项目导出到 jar 文件中,然后使用 Java 脚本调用 Mirth,它做了一个 hello world application.I 相信我添加了 jar 文件 way.However 我在 Java OCR 中遇到问题,所以我得到这个错误,
ERROR (com.mirth.connect.connectors.js.JavaScriptDispatcher:193): Error evaluating JavaScript Writer (JavaScript Writer "RTF>DCM" on channel b469e5af-a78d-41ca-86a0-a7b507799a4d).
java.lang.NoClassDefFoundError: net/sourceforge/tess4j/TesseractException
package com.imagerad.ocr;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import net.sourceforge.tess4j.ITesseract;
import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;
public class JavaOCRTest {
static String Tc;
static String phone;
static String date;
public static void main(String[] args) throws IOException{
}
public String returnText(String fileName) throws IOException{
Files.walk(Paths.get(fileName)).forEach(filePath -> {
if (Files.isRegularFile(filePath)) {
File imageFile = filePath.toFile();
ITesseract instance = new Tesseract();
try {
String result = instance.doOCR(imageFile);
int i=result.indexOf("Numarasn: ");
int j=result.indexOf("Tel No:");
int k=result.indexOf("Bilgllendirme Tarihl:");
Tc = result.substring(i+10, i+22);
phone = result.substring(j+8,j+23);
date = result.substring(k+22,k+32);
} catch (TesseractException e) {
System.err.println(e.getMessage());
}
}
});
return Tc+""+phone+""+date;
}
public String returnTC() throws IOException{
return Tc;
}
public String returnPhone() throws IOException{
return phone;
}
public String returnDate() throws IOException{
return date;
}
}
非常感谢您的帮助。
您必须下载 Tess4J.jar 并将其添加到 class 路径。此 jar 包含缺少的 class net/sourceforge/tess4j/TesseractException
我尝试使用 Java 和 Tesseract.I 为 Mirth 做一个 ocr 应用程序,将项目导出到 jar 文件中,然后使用 Java 脚本调用 Mirth,它做了一个 hello world application.I 相信我添加了 jar 文件 way.However 我在 Java OCR 中遇到问题,所以我得到这个错误,
ERROR (com.mirth.connect.connectors.js.JavaScriptDispatcher:193): Error evaluating JavaScript Writer (JavaScript Writer "RTF>DCM" on channel b469e5af-a78d-41ca-86a0-a7b507799a4d). java.lang.NoClassDefFoundError: net/sourceforge/tess4j/TesseractException
package com.imagerad.ocr;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import net.sourceforge.tess4j.ITesseract;
import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.TesseractException;
public class JavaOCRTest {
static String Tc;
static String phone;
static String date;
public static void main(String[] args) throws IOException{
}
public String returnText(String fileName) throws IOException{
Files.walk(Paths.get(fileName)).forEach(filePath -> {
if (Files.isRegularFile(filePath)) {
File imageFile = filePath.toFile();
ITesseract instance = new Tesseract();
try {
String result = instance.doOCR(imageFile);
int i=result.indexOf("Numarasn: ");
int j=result.indexOf("Tel No:");
int k=result.indexOf("Bilgllendirme Tarihl:");
Tc = result.substring(i+10, i+22);
phone = result.substring(j+8,j+23);
date = result.substring(k+22,k+32);
} catch (TesseractException e) {
System.err.println(e.getMessage());
}
}
});
return Tc+""+phone+""+date;
}
public String returnTC() throws IOException{
return Tc;
}
public String returnPhone() throws IOException{
return phone;
}
public String returnDate() throws IOException{
return date;
}
}
非常感谢您的帮助。
您必须下载 Tess4J.jar 并将其添加到 class 路径。此 jar 包含缺少的 class net/sourceforge/tess4j/TesseractException