2017-01-09 102 views
0

我有困难的时间试图转换我的.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> 

回答

0

只是删除相关的方法和类的最新版本的所有代码,并改变它降低的Java库版本,可能它的工作,因为我有这样的错误