Re: [Ikvm-developers] Evading NoClassDefFoundError
Brought to you by:
jfrijters
From: Jeroen F. <je...@su...> - 2007-07-28 07:02:18
|
Jose Ramon Palanco wrote: > I was using ikvmc to generate IL from java to analize the content and > generate statistical data. I don't need to execute the IL. The problem > became when I try to generate IL code from a jar which depends on > others jars. What exactly are you trying to analyze? If it's properties of the original = classes, you might be better off by writing your own analyzer (based on Cla= ssFile to parse the classes). > From ikvmc: > ClassFile c =3D new ClassFile(buf, 0, buf.Length, s); > > The ClassFile() constructor throw NoClassDefFoundError exception and > the begining code is not generated and clases extending of classes > depending on others jar are not generated. The ClassFile constructor doesn't actually throw the exception. It can load= any well formed class file. Later on when a TypeWrapper instance is constr= ucted, the base class and implemented interfaces are loaded, if any of thos= e fail the class itself is considered missing (like on the reference JVM). > Is posible modify to generate the code although we don't have the jars? > I don't need execute it, I just need generate de IL code. I suppose you could automatically generate stubs classes for missing classe= s, but it's pretty far outside of IKVMs scope. > I see a hack in the code to avoid this kind of exceptions in > ikvm/starter.cs : > > private static Method FindMainMethod(java.lang.Class clazz) > { > // HACK without this hack, clazz.getDeclaredMethods > would throw a NoClassDefFoundError if any > // of the methods in the class had an unloadable > parameter type, but we don't want that. > ... This is only about missing classes that aren't used as base class or implem= ented interfaces. Regards, Jeroen |