Discussion:
[Ikvm-developers] ServiceLoader not working after compiling the jar to a DLL
Venkateswarlu Yerramalli
2016-07-20 12:23:39 UTC
Permalink
Hi,

I have a jar file from a java project and am trying to use this in a .NET
project. I am successful in using ikvmc to create a dll out of the jar and
when I try to call the methods it fails with
a System.NullReferenceException.

The method where this exception is originating relies on the java
ServiceLoader to load provider implementation and the implementations are
also packaged as part of the same jar that was used for creating the DLL.

Is serviceLoading supported when compiled to a DLL? If so how do I use it?

Thanks,

Venkat
Jeroen Frijters
2016-07-20 15:08:16 UTC
Permalink
Hi Venkat,

ServiceLoader is supported, but the class loader needs to know about the DLL. You can try using ikvm.runtime.Startup.addBootClassPathAssembly() to add your DLL to the boot class loader.

Regards,
Jeroen

From: Venkateswarlu Yerramalli [mailto:***@gmail.com]
Sent: Wednesday, July 20, 2016 14:24
To: ikvm-***@lists.sourceforge.net
Subject: [Ikvm-developers] ServiceLoader not working after compiling the jar to a DLL

Hi,

I have a jar file from a java project and am trying to use this in a .NET project. I am successful in using ikvmc to create a dll out of the jar and when I try to call the methods it fails with a System.NullReferenceException.

The method where this exception is originating relies on the java ServiceLoader to load provider implementation and the implementations are also packaged as part of the same jar that was used for creating the DLL.

Is serviceLoading supported when compiled to a DLL? If so how do I use it?

Thanks,

Venkat

Loading...