Valentin P. Valentin P. - 3 months ago 24x
Java Question

Converting Java to .NET library using IKVMC

There is Java tool (it is called Mallet)
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$
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.

Can somebody help?



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