我正在尝试在C#中使用Stanford CoreNLP(这是一个Java项目).
I'm trying to use Stanford CoreNLP (which is a Java project) in C#.
我发现了这个 Nuget软件包,其中包含转换为CoreNLP的.NET使用IKVM,并且运行良好,但是我也需要在Java项目上进行一些修改.
I found this Nuget package which contains CoreNLP converted to .NET using IKVM, and it's working fine, however I need to do some modifications on the java project as well.
我从 Github 下载了CoreNLP,我可以从Ant构建CoreNLP JAR,并且运行良好在eclipse中,但是在将JAR转换为DLL时遇到问题.根据一些构建日志,我在Google中找到了,我正在这样做:
I downloaded CoreNLP from Github, I can build the CoreNLP JAR from Ant, and it's also running fine in eclipse, however I'm having problems in converting JAR to DLL. Based on some build-log that I found in google, I'm doing this:
ikvmc.exe -version:2.1 ..\lib\joda-time.jar -out:joda-time.dll ikvmc.exe -r:joda-time.dll -version:0.4.7 ..\lib\jollyday-0.4.7.jar -out:jollyday.dll ikvmc.exe -version:0.23 ..\lib\ejml-0.23.jar -out:ejml-0.23.dll ikvmc.exe -version:1.2.10 ..\lib\xom-1.2.10.jar -out:xom.dll ikvmc.exe -version:1.0 ..\lib\javax.json.jar -out:javax.json.dll ikvmc.exe -r:joda-time.dll -r:jollyday.dll -r:ejml-0.23.dll -r:xom.dll -r:javax.json.dll -version:3.5.0 ..\javanlp-core.jar -out:javanlp-core.dll我从以下转换中得到的都是关于找不到的有关引用分类的一些警告:
All I get from the following conversions are a few warnings about referenced classed that can't be found:
warning IKVMC0100: Class "org.apache.xerces.parsers.SAXParser" not found warning IKVMC0100: Class "junit.framework.TestCase" not found warning IKVMC0100: Class "org.apache.xerces.impl.Version" not found ... warning IKVMC0100: Class "junit.framework.TestCase" not found warning IKVMC0100: Class "javax.servlet.http.HttpServlet" not found warning IKVMC0100: Class "javax.servlet.Filter" not found warning IKVMC0100: Class "com.google.protobuf.Descriptors$FileDescriptor$InternalDescriptorAssigner" not found warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$Builder" not found warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage" not found warning IKVMC0100: Class "com.google.protobuf.MessageOrBuilder" not found warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableBuilder" not found warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableMessage" not found warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$ExtendableMessageOrBuilder" not found warning IKVMC0100: Class "com.google.protobuf.Internal$EnumLiteMap" not found warning IKVMC0100: Class "com.google.protobuf.ProtocolMessageEnum" not found warning IKVMC0100: Class "junit.framework.TestSuite" not found warning IKVMC0100: Class "junit.framework.Assert" not found warning IKVMC0100: Class "com.apple.eawt.ApplicationAdapter" not found warning IKVMC0100: Class "org.junit.Assert" not found warning IKVMC0100: Class "org.apache.lucene.analysis.core.KeywordAnalyzer" not found warning IKVMC0100: Class "org.apache.lucene.index.IndexWriterConfig" not found warning IKVMC0100: Class "org.apache.lucene.util.Version" not found warning IKVMC0100: Class "org.apache.lucene.store.FSDirectory" not found warning IKVMC0100: Class "org.apache.lucene.index.DirectoryReader" not found warning IKVMC0100: Class "org.apache.lucene.search.IndexSearcher" not found warning IKVMC0100: Class "org.apache.lucene.search.BooleanQuery" not found warning IKVMC0100: Class "org.apache.lucene.search.BooleanClause" not found warning IKVMC0100: Class "org.apache.lucene.search.TermQuery" not found warning IKVMC0100: Class "org.apache.lucene.index.Term" not found warning IKVMC0100: Class "org.apache.lucene.search.BooleanClause$Occur" not found warning IKVMC0100: Class "org.apache.lucene.search.TopDocs" not found warning IKVMC0100: Class "org.apache.lucene.search.ScoreDoc" not found warning IKVMC0100: Class "org.apache.lucene.document.Document" not found warning IKVMC0100: Class "org.apache.lucene.index.IndexWriter" not found warning IKVMC0100: Class "org.apache.lucene.queryparser.classic.ParseException" not found warning IKVMC0100: Class "org.apache.lucene.document.StringField" not found warning IKVMC0100: Class "org.apache.lucene.document.Field$Store" not found warning IKVMC0100: Class "org.apache.lucene.document.Field" not found warning IKVMC0100: Class "org.apache.lucene.search.Query" not found warning IKVMC0100: Class "org.apache.lucene.store.Directory" not found warning IKVMC0100: Class "org.apache.lucene.index.CheckIndex" not found warning IKVMC0100: Class "org.apache.lucene.index.CheckIndex$Status" not found warning IKVMC0100: Class "org.apache.lucene.store.NIOFSDirectory" not found warning IKVMC0100: Class "org.apache.lucene.util.BytesRef" not found warning IKVMC0100: Class "org.apache.lucene.index.IndexReader" not found warning IKVMC0100: Class "com.google.protobuf.Descriptors$FileDescriptor" not found warning IKVMC0100: Class "com.google.protobuf.Descriptors$Descriptor" not found warning IKVMC0100: Class "com.google.protobuf.GeneratedMessage$FieldAccessorTable" not found warning IKVMC0100: Class "com.google.protobuf.Descriptors" not found warning IKVMC0100: Class "junit.framework.AssertionFailedError" not found warning IKVMC0100: Class "org.apache.lucene.document.FieldType" not foundP.S .:我也尝试过转换protobuf.jar,但对下面描述的问题没有帮助.
P.S.: I also tried converting protobuf.jar, but didn't help with the problem described below.
问题是:当我将Nuget引用替换为新编译的引用(6个dll)时,它可以正常编译(查找所有引用),但是抛出此 MissingMethodException:其他信息:未找到方法:'Void edu .stanford.nlp.pipeline.StanfordCoreNLP..ctor(java.util.Properties)'.
Problem is: when I replace the Nuget references for my freshly-compiled references (6 dlls), it compiles fine (finds all references), but throws this MissingMethodException: Additional information: Method not found: 'Void edu.stanford.nlp.pipeline.StanfordCoreNLP..ctor(java.util.Properties)'.
谁能阐明一些想法?
推荐答案我想我已经知道了.这是固定的内容:
I guess I figured it out. Here is what fixed:
如果我正确理解,我用来转换JAR文件的ikvmc.exe必须与所引用的运行时DLL的版本相同.
If I understand correctly, the ikvmc.exe I used to convert my JAR files must be the same version of the referenced runtime DLLs.
更多推荐
使用IKVM的MissingMethodException
发布评论