Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting Java to .NET library using IKVMC - Warning IKVMC0108: not a class file

Tags:

java

.net

ant

ikvm

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.

like image 642
Valentin P. Avatar asked Oct 24 '11 11:10

Valentin P.


2 Answers

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

like image 109
Joachim Sauer Avatar answered Nov 16 '22 08:11

Joachim Sauer


FYI v8.1 (currently in RC) of IKVM supports Java 8:

http://weblog.ikvm.net/2015/08/26/IKVMNET81ReleaseCandidate0.aspx http://sourceforge.net/p/ikvm/mailman/message/34502991/

like image 32
csauve Avatar answered Nov 16 '22 09:11

csauve