I have some properties in an object that I would like to add to the global namespace. In javascript on the browser I could just add it to the window object like so:
window
Here's how I've done it in the past:
// Rhino setup Context jsContext = Context.enter(); Scriptable globalScope = jsContext.initStandardObjects(); // Define global variable Object globalVarValue = "my value"; globalScope.put("globalVarName", globalScope, globalVarValue);