TypeInitializationException未处理

时间:2012-04-05 15:19:03

标签: java

我在C#语言中使用opennlp工具。 我写了以下代码:

string modelpath = @"D:\models\en-sent.bin";
java.io.FileInputStream modelInpStream = new java.io.FileInputStream(modelpath);
SentenceModel model = new SentenceModel(modelInpStream);
SentenceDetectorME sentenceDetector = new SentenceDetectorME(model);

但它在行中引起了TypeInitializationException:

SentenceModel model = new SentenceModel(modelInpStream);

异常消息:

TypeInitializationException was unhandled
The type initializer for 'java.nio.charset.StandardCharsets' threw an exception.

1 个答案:

答案 0 :(得分:0)

假设您使用IKVM代码将openNLP jar文件转换为.Net,您只需要在项目中包含IKVM Charsets dll即可。