Search code examples
dlljarikvm

IKVM 7.0 - how to successfully create a DLL file from JAR


I have a problem creating a DLL file from a JAR file with IKVM (version: 7.0.4335.0).

The JAR itself can be run if I open it with the command:

ikvm -jar MyTest1.jar

I can see the System.out.print("test") output in the console.

However, converting it to a DLL with:

ikvm MyTest1.jar

gives me the error:

C:\Users\de\Desktop>ikvm MyTest1.jar
Exception in thread "main" java.lang.ClassNotFoundException: MyTest1.jar
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(AccessController.java:279
)
    at java.security.AccessController.doPrivileged(AccessController.java:520
)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:450)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:385)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:503)
    at IKVM.Internal.ClassLoaderWrapper.LoadClassImpl(Unknown Source)
    at IKVM.Internal.ClassLoaderWrapper.LoadClassByDottedNameFastImpl(Unknow
n Source)
    at IKVM.Internal.ClassLoaderWrapper.LoadClassByDottedName(Unknown Source
)
    at IKVM.NativeCode.java.lang.Class.forName0(Unknown Source)
    at java.lang.Class.forName(Class.java:361)

According to the documentation IKVM Doc I have to do this:

If ikvm reports a ClassNotFoundException, check whether the CLASSPATH environment variable is set. If so, try clearing the CLASSPATH or adding the current directory to it so ikvm can find the class in the current directory.

But the (system environment) classpath variable is set properly. (CLASSPATH=.; / JAVA_HOME=C:\Program Files\Java\jdk1.6.0_21 / Path=%JAVA_HOME%\bin;)

Update: I just could build the DLL file using this post here. Anyways, the above problem remains and I am wondering what I need to do to fix this.

Thanks for help.


Solution

  • If you want create a dll then you need to use ikvmc and not ikvm. This is like java and javac.