Hi all,

I am experimenting with a rhino powered JavaScript shell for Eclipse
3.6. It was quite easy to get it running for pure JavaScript code.

Now I am facing problems when I try to access Java classes through the
LiveConnect feature.

Accessing "Packages.something..." works only for Java classes of the JRE
and for classes provided by the org.mozilla.javascript bundle (which
contains Context.class, etc). Classes of other bundles cannot be
accessed. Seems the classloader simply doesn't find them.

So I tried to register a different classloader:

ContextFactory.getGlobal().initApplicationClassLoader(Platform.class.getClassLoader());

but this fails as

 public final void initApplicationClassLoader(ClassLoader loader)
    {
        if (loader == null)
            throw new IllegalArgumentException("loader is null");
        if (!Kit.testIfCanLoadRhinoClasses(loader))
            throw new IllegalArgumentException(
                "Loader can not resolve Rhino classes");

        if (this.applicationClassLoader != null)
            throw new IllegalStateException(
                "applicationClassLoader can only be set once");
        checkNotSealed();

        this.applicationClassLoader = loader;
    }


throws IllegalArgumentException("Loader can not resolve Rhino classes")


So I am stuck with 2 classloaders: 1 supports eclipse, but not rhino,
the other supports rhino, but not eclipse.

Is there a classloader out there that supports both worlds?

thanks
Christian Pontesegger
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to