使用 IKVMC 将 Java 转换为 .NET 库 - 警告 IKVMC0108:不是类文件

发布于 2024-12-11 14:03:39 字数 828 浏览 6 评论 0原文

有一个Java工具(称为Mallet) http://mallet.cs.umass.edu/download.php 我想在我的 .NET 项目中使用它。

为了首先将此工具转换为 .NET 库,我尝试使用 Apache Ant 在单个 .jar 文件中构建它。我已完成与上面链接中的说明相对应的所有操作。

  1. 从 Mercurial 存储库下载开发人员版本。

  2. 下载 Apache Ant,安装 JDK,设置 JAVA_HOME var 以使用 Apache Ant。

  3. 使用 Ant,我构建了单个 mallet.jar 文件。

然后我会使用 IKVMC 将 mallet.jar 转换为 .NET 库。 转换时,我收到很多警告,例如:

Warning IKVMC0108: not a class file "cc/mallet/util/tests/TestPriorityQueue$1.cl
ass", including it as resource
    (class format error "51.0")

尽管有这些警告,还是创建了 mallet.dll。但是当我尝试从我的 .NET 项目中引用它时,它看起来“空”。它没有任何类或名称空间。我不会忘记引用 IKVM.OpenJDL.Core。

这很不寻常,我在谷歌中找不到任何相同的问题。

我认为问题在于警告。而且我从未使用过Ant,所以我不太了解所有流程。

There is Java tool (it is called Mallet)
http://mallet.cs.umass.edu/download.php
which I want to use in my .NET project.

To convert this tool to .NET library at first I've tried to build it in single .jar file using Apache Ant. I've done everything corresponding to instructions at link above.

  1. Download Developer Release from Mercurial repository.

  2. Download Apache Ant, install JDK, set JAVA_HOME var to use Apache Ant.

  3. Using Ant I've built single mallet.jar file.

And then I would to convert mallet.jar to .NET library using IKVMC.
When converting, I've got a lot of warnings such as:

Warning IKVMC0108: not a class file "cc/mallet/util/tests/TestPriorityQueue$1.cl
ass", including it as resource
    (class format error "51.0")

Despite of these warnings, mallet.dll was created. But when I try to reference to it from my .NET project, it looks "empty". It has not any classes or namespaces. I don't forget to reference to IKVM.OpenJDL.Core.

And this is unusual that I can't find any same problems in Google.

I think that problem is in warnings. And I have never worked with Ant and I don't understand all process exactly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

护你周全 2024-12-18 14:03:39

类格式版本 51 是随 Java 7 引入的。IKVM

很可能还不支持该版本,并且您引用的文件名 (cc/mallet/util/tests/TestPriorityQueue$1.class) 指向TestPriorityQueue 的匿名内部类肯定是库正常工作所必需的。

我的建议:使用较旧的 JDK 编译 Mallet,或者至少使用将 -source-target 开关设置为 6 (以确保它针对 Java 6 进行编译)。

The class format version 51 was introduced with Java 7.

IKVM most likely doesn't support that version yet and the file name you quote (cc/mallet/util/tests/TestPriorityQueue$1.class) points at an anonymous inner class of TestPriorityQueue that certainly is needed for the library to work correctly.

My suggestion: compile Mallet using an older JDK or at least using the -source and -target switches set to 6 (to ensure that it's compile for Java 6).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文