Scriptable scope = new ImporterTopLevel(cx);
scope.put("parent", scope, parentContainer);
scope.put("assemblyScope", scope, assemblyScope);
ImporterTopLevel.importPackage(cx,
scope, new NativeJavaPackage[]{
new NativeJavaPackage("org.picocontainer.defaults", loader),
new NativeJavaPackage("org.nanocontainer", loader),
new NativeJavaPackage("org.nanocontainer.reflection", loader),
// File, URL and URLClassLoader will be frequently used by scripts.
new NativeJavaPackage("java.net", loader),
new NativeJavaPackage("java.io", loader),
},
null);
Script scriptObject = cx.compileReader(scope, getScriptReader(), "javascript", 1, null);
scriptObject.exec(cx, scope);
Object pico = scope.get("pico", scope);