Re: [Ikvm-developers] Call C# method from Java
Brought to you by:
jfrijters
|
From: Jeroen F. <je...@su...> - 2012-09-13 14:28:07
|
Hi Maxim, That's weird. I have no idea what could be going on. Regards, Jeroen > -----Original Message----- > From: Maxim Donde [mailto:Ma...@so...] > Sent: Thursday, September 13, 2012 16:24 > To: Jeroen Frijters; ikv...@li... > Subject: RE: Call C# method from Java > > Hi Jeroen, > Thanks for your answer. The problem was caused by this C# class member: > private static ThreadLocal<string> x = new ThreadLocal<string>(); Do you > have any clue why? > Thanks, > Maxim > > -----Original Message----- > From: Jeroen Frijters [mailto:je...@su...] > Sent: Tuesday, September 11, 2012 02:06 PM > To: Maxim Donde; ikv...@li... > Subject: RE: Call C# method from Java > > Hi, > > In Java you can also get a NoClassDefFoundError if a class initializer > threw an exception. So make sure your C# code doesn't throw any > exceptions from the class initializer (aka class constructor). > > Most other scenarios where you get a NoClassDefFoundError would result > in an ikvmc warning during compilation, so if you don't see those, the > above is the most likely cause. > > Regards, > Jeroen > > > -----Original Message----- > > From: Maxim Donde [mailto:Ma...@so...] > > Sent: Tuesday, September 11, 2012 12:42 > > To: ikv...@li... > > Subject: [Ikvm-developers] Call C# method from Java > > > > Hi, > > > > I'm using the IKVM to call Java methods from my C# application and > this > > works fine (as long as I'm compiling all the jars in one dll). Now I'm > > trying to provide in my C# application some helper class for Java > > methods to use C# related utilities (Azure methods). To achieve this, > I > > created a new C# dll and converted it to jar using ikvmstub. Since I'm > > using .NET 4 I used -nostdlib and - > > r:\windows\microsoft.net\framework\v4.0.30319\mscorlib.dll flags. > > > > So I created a new jar and added it to my Java code. Now I'm trying to > > use this Java code inside the C# application. I compiled the new class > > and the new jar using ikvmc the same way I did this before, but with > the > > same -nostdlib and - > > r:\windows\microsoft.net\framework\v4.0.30319\mscorlib.dll flags. The > > only compiled warning I saw was: "warning IKVMC0123: Assuming assembly > > reference "System, Version=4.0.0.0, Culture=neutral, > > PublicKeyToken=b77a5c561934e089" matches "System, Version=2.0.0.0, > > Culture=neutral, PublicKeyToken=b77a5c561934e089", you may need to > > supply runtime policy" but I assume this should be not a problem. > > > > But when I trying to call in my C# application the Java code that uses > > c# helper method I get NoClassDefFoundError for my C# helper class. > > > > Please assist. > > > > Thanks, > > > > Maxim > > > > |