Search code examples
java.netclasspathembedded-resourceikvm

Where does IKVM get its CLASSPATH from?


I have a .NET assembly that was converted from a jar file. This library looks for files in its classpath. I keep getting missing resource exceptions when running the application.

I have tried: - Putting the resource file in my bin folder - Putting the resource file in my source folder, including it in the VS project and setting copy local to on - setting a CLASSPATH environment variable to a folder containing the resource file

None of the above have worked. Does anyone know where IKVM expects to see its classpath or another way I can get my program to see the resource file?


Solution

  • According to the ikvm documentation, ikvm behaves similar to java. This should work:

    ikvm -cp .;relative/path/to/jar/lib.jar com.example.MyClass
    

    Got it - loading resources from the classpath does work in Java but not in the compiled .net assembly. The -resource parameter could be the one that does the trick but unfortunately there's no example on the ByteCode Compiler page.

    Related question