Re: [Ikvm-developers] ClassLoader and Class.forName
Brought to you by:
jfrijters
|
From: axel s. (i. gmbh) <axe...@in...> - 2013-11-19 09:49:30
|
Add -target:library to your ikvmc command line. -- Axel Stumpp Softwareentwicklung, Beratung innoWake gmbh innovativ | nachhaltig | flexibel IT-Tower Robert-Bosch-Str. 1 | 89250 Senden Fon: +49.7307.92190.162 Fax: +49.7307.92190.20 axe...@in... www.innowake.de HRB Memmingen 13512 Geschäftsführer: Thorsten Bernecker, Björn Langmack, Mirko Schliemann This e-mail may contain confidential information. If you are not the intended recipient please notify the sender immediately and destroy this e-mail. Von: Mihaela Topa [mailto:mih...@ya...] Gesendet: Dienstag, 19. November 2013 10:17 An: Jeroen Frijters; ikv...@li... Betreff: Re: [Ikvm-developers] ClassLoader and Class.forName Hello Jeroen Thank you very much. It works! But if one project contains "main" function, ikvmc generates an "exe" instead of a "dll". Can I force it to generate a "dll"? Best regards, Mihaela From: Jeroen Frijters <je...@su...<mailto:je...@su...>> To: Mihaela Topa <mih...@ya...<mailto:mih...@ya...>>; "ikv...@li...<mailto:ikv...@li...>" <ikv...@li...<mailto:ikv...@li...>> Sent: Tuesday, November 19, 2013 9:38 AM Subject: RE: [Ikvm-developers] ClassLoader and Class.forName 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...<mailto:mih...@ya...>] > Sent: Monday, November 18, 2013 20:48 > To: ikv...@li...<mailto: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 |