Browse files

Re-init top level java packages after creating the classloader

This lets the convenience top-level java packages (java, com, org...)
use the new classloader in addition to Packages.
  • Loading branch information...
1 parent 80e8393 commit 31623cdeedab3f188f525579fb892efb02272820 @hns hns committed Mar 25, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 engines/rhino/lib/packages-engine.js
View
6 engines/rhino/lib/packages-engine.js
@@ -67,10 +67,12 @@ exports.addJavaPaths = function addJavaPaths(javaPaths) {
try {
/* intall jar loader */
- //Packages.java.lang.Thread.currentThread().setContextClassLoader(loader);
+ Packages.java.lang.Thread.currentThread().setContextClassLoader(loader);
context.setApplicationClassLoader(loader);
// must explicitly be made global when each module has it's own scope
- global.Packages = new Packages(loader);
+ // global.Packages = new Packages(loader);
+ // re-init the top-level java packages objects with the new classloader
+ Packages.org.mozilla.javascript.NativeJavaTopPackage.init(context, global, false);
installed = true;
} catch (e) {
print("warning: couldn't install jar loader: " + e);

0 comments on commit 31623cd

Please sign in to comment.