Subj : Rhino not wrapping java.lang.Class into NativeJavaClass object To : netscape.public.mozilla.jseng From : "Jeremy Kwiatkowski" Date : Fri May 02 2003 02:31 pm Hello, I'm integrating Rhino into an application that supports dynamic class loading through an application defined class loader. Then, I want to call a static method that may be defined on the dynamically loaded class. I put the class factory into the scope, so it's available like so: var clazz = classFactory.getClass("some.package.name"); If I print out clazz, I see that it is indeed a Java Class object. Unfortunately, it seems to be wrapped in a JavaNativeObject, rather than a Java NativeClass object. Therefore, this fails: clazz.invokeSomeStaticMethod(); I can fix the problem either by performing the wrapping manually, or, with the the following WrapFactory: public class Wrapper extends org.mozilla.javascript.WrapFactory { public Object wrap(Context cx, Scriptable scope, Object obj, Class staticType) { if (obj instanceof Class) { return new NativeJavaClass(scope, (Class)obj); } else { return super.wrap(cx, scope, obj, staticType); } } } What confuses me, though, is that there were some messages on this topic in the 1999 timeframe. What I'm trying to understand is whether this feature shouldn't be used (for some reason I don't understand), was just lost, is a known issue, is there some other way I should be doing this?, etc. Thanks for any insight into this Jeremy .