我有困難的時間試圖轉換我的.jar庫.dll .dll,並使其工作由IKVM框架。 我寫了一個Java庫,可以正常工作,因爲它已經在幾個Java項目中成功測試過了,但我強烈需要.NET的.dll。IKVM jar的dll問題
當我啓動命令:
ikvm -jar mylib.jar
一切都很好(我也試圖與一個主文件,以確保:它的工作原理)。
但是,當我鍵入:
ikvmc -target:library mylib.jar
我得到了很多的警告,但仍然會創建.dll文件。重要的是要說所有的警告都與我不在我的項目中使用的庫相關,但我非常確定在我導入Maven的包中對我來說是非常重要的。 我不知道真正的問題是在這一步,因爲我看網上忽略這些警告,但可以肯定我張貼輸出一點點:
warning IKVMC0100: Class "junit.framework.TestCase" not found
warning IKVMC0100: Class "javax.servlet.http.HttpServlet" not found
warning IKVMC0100: Class "javax.servlet.ServletOutputStream" not found
warning IKVMC0100: Class "org.junit.Assert" not found
warning IKVMC0100: Class "junit.framework.TestSuite" not found
warning IKVMC0100: Class "org.apache.tools.ant.taskdefs.MatchingTask" not found
讓我們假設這一步是確定,現在我必須導入我的C#應用程序的參考文獻中的IKVM庫和mylib.dll文件。我做了,結果很奇怪:自動完成環境建議我只使用4個Java類,而忽略其他99%。我認爲出了點問題,但我很難理解在哪裏以及如何解決問題。
只是更多有用的信息:我使用Maven,Java8(SDK 1.8)和IKVM 8 我也試過同樣與IKVM 7,仍然得到了同樣的錯誤。 最後,這是我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.fra.mylibrary</groupId>
<artifactId>MyLibrary</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>MYLIBRARY</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- https://mvnrepository.com/artifact/net.sourceforge.owlapi/owlapi-distribution -->
<dependencies>
<!-- https://mvnrepository.com/artifact/net.sourceforge.owlapi/owlapi-distribution -->
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-distribution</artifactId>
<version>4.1.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.antlr/antlr4-runtime -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sourceforge.owlapi/jfact -->
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>jfact</artifactId>
<version>4.0.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- ANTLR4 -->
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>4.5.3</version>
<executions>
<execution>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
<configuration>
</configuration>
</plugin>
<!-- Maven Assembly Plugin to create Jar -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<!-- Maven Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>