TypeInitializationException was unhandled

Go To StackoverFlow.com

1

I'm using opennlp tool in C# language. I wrote the following code:

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);

but it caused a TypeInitializationException in the line:

SentenceModel model = new SentenceModel(modelInpStream);

the Exception message:

TypeInitializationException was unhandled
The type initializer for 'java.nio.charset.StandardCharsets' threw an exception.
2012-04-05 15:19
by sofia
Umm, this is Java not C#? Unless you're really using SharpNLP - Yuck 2012-04-05 15:20


0

Assuming you used the IKVM code to convert the openNLP jar files to .Net, you should just need to include the IKVM Charsets dll as well in your project for this to work.

2012-05-01 22:12
by CarlC
Ads