大家好,我有一个用java编写的代码,在net beans中运行得很好,但是当我想在eclipse中运行时,这个异常出现了。
Exception in thread "main" class com.aspose.ocr.internal.g: Culture Name: en-US-EN is not a supported culture
com.aspose.ocr.internal.aP.b(Unknown Source)
com.aspose.ocr.internal.aP.<init>(Unknown Source)
com.aspose.ocr.internal.aP.a(Unknown Source)
com.aspose.ocr.internal.dj.b(Unknown Source)
com.aspose.ocr.internal.aP.c(Unknown Source)
com.aspose.ocr.internal.cG.c(Unknown Source)
com.aspose.ocr.z.<init>(Unknown Source)
com.aspose.ocr.ImageStream.fromFile(Unknown Source)
I.main(I.java:33)
at com.aspose.ocr.internal.aP.b(Unknown Source)
at com.aspose.ocr.internal.aP.<init>(Unknown Source)
at com.aspose.ocr.internal.aP.a(Unknown Source)
at com.aspose.ocr.internal.dj.b(Unknown Source)
at com.aspose.ocr.internal.aP.c(Unknown Source)
at com.aspose.ocr.internal.cG.c(Unknown Source)
at com.aspose.ocr.z.<init>(Unknown Source)
at com.aspose.ocr.ImageStream.fromFile(Unknown Source)
at I.main(I.java:33)这是mi代码
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import com.aspose.ocr.ILanguage;
import com.aspose.ocr.ImageStream;
import com.aspose.ocr.Language;
import com.aspose.ocr.OcrEngine;
public class I {
public static void main(String[] args) {
// Set the paths
String imagePath = "samples/Sample.bmp";
String resourcesFolderPath = "../resources/resource.zip";
// Create an instance of OcrEngine
OcrEngine ocr = new OcrEngine();
// Set Resources for OcrEngine
try {
ocr.setResource(new FileInputStream(resourcesFolderPath));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// Set NeedRotationCorrection property to false
// ocr.getConfig().setNeedRotationCorrection(false);
// Set image file
ocr.setImage(ImageStream.fromFile(imagePath));
// Add language
ILanguage language = Language.load("spanish");
ocr.getLanguages().addLanguage(language);
// Perform OCR and get extracted text
try {
if (ocr.process()) {
System.out.println("\ranswer -> " + ocr.getText());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}我的版本是露娜(4.4.0)和net beans 8
提前感谢您的时间和回答
发布于 2018-07-12 08:20:09
Aspose有一些bug,它会抛出“文化”(普通人称之为“locale”)的异常,而这些“文化”(Locale)不在其硬编码的支持列表中。
不知何故,我猜当在Eclipse下运行时,您的语言环境字符串是"en-US-EN“,但在NetBeans下运行时则不是。
您可以尝试在命令行上传递user.language、user.country、user.variant系统属性,以覆盖运行应用程序时的任何设置。
免责声明:我自己不使用Eclipse。
https://stackoverflow.com/questions/25612424
复制相似问题