gpt4 book ai didi

java - TypeInitializationException 未处理

转载 作者:行者123 更新时间:2023-12-01 05:23:08 24 4
gpt4 key购买 nike

我正在使用 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.

最佳答案

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

关于java - TypeInitializationException 未处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10031363/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com