tags:

views:

25

answers:

1

I have a .Net assembly that was converted from a jar file. This Library looks for files in it's 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 it's classpath or another way I can get my program to see the resource file?

+2  A: 

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

Andreas_D
The problem with that is that I am using ikvmc so I am not running my JAR file directly, but rather converting it to a .Net library for use in my .Net applications. It looks like the ikvm command expects you to run a jar file.
Tjaart
Using the code on the related question I was able to load the resource file directory. Thanks for the help.
Tjaart