Hi Christian, Sounds a little bit like what I was using for Rhino / Eclipse integration a while back...
See: http://dev.eclipse.org/viewcvs/index.cgi/e4/org.eclipse.e4.languages/bundles/org.eclipse.e4.javascript/src/org/eclipse/e4/internal/javascript/BundleProxyClassLoader.java?view=markup http://dev.eclipse.org/viewcvs/index.cgi/e4/org.eclipse.e4.languages/bundles/org.eclipse.e4.javascript/src/org/eclipse/e4/internal/javascript/RhinoClassLoader.java?view=markup Basically you create a class loader that chains rhino to another bundle for classloading purposes. HTH -Simon "Christian Pontesegger" <[email protected]> wrote in message news:[email protected]... > 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
