Re: [Ikvm-developers] ClassLoader and Class.forName
Brought to you by:
jfrijters
|
From: Jeroen F. <je...@su...> - 2013-11-19 07:39:09
|
Hi,
First, why not compile everything into one jar?
Second, the -classloader:ikvm.runtime.ClassPathAssemblyClassLoader has nothing to do with this scenario.
The easiest solution is this:
ikvmc -sharedclassloader { ProjectA.jar } { ProjectB.jar }
This will compile the jars into two separate assemblies, but they will share the class loader (this implies that ProjectA.dll is always necessary to use ProjectB.dll, but not the other way around).
Another option is to change the Java code that does Class.forName() to use the assembly qualified type name of the class.
Regards,
Jeroen
> -----Original Message-----
> From: Mihaela Topa [mailto:mih...@ya...]
> Sent: Monday, November 18, 2013 20:48
> To: ikv...@li...
> Subject: [Ikvm-developers] ClassLoader and Class.forName
>
> Hello
>
> I have the following scenario. ProjectA.jar has a class which creates an
> instance of a class from ProjectB.jar using Class.forName. I used IKVM
> with option -classloader:ikvm.runtime.ClassPathAssemblyClassLoader to
> compile both jar files in two dlls.
> I created a C# application which has a referrence only to the ProjectA
> and calls the method which creates by reflection the instance of the
> class from ProjectB. But Class.forName throws ClassNotFoundException.
>
> I attach the example.
>
> If I compile ProjectA.jar and ProjectB.jar in one dll everything is ok.
> I use ikvm-7.2.4630.5.
>
> Best regards,
> Mihaela
|