Error "window" is not defined when loading Protovis from javax.script?
- by Shane
I am loading Protovis using javax.script:
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName(scriptEngine);
engine.eval(new java.io.FileReader("protovis-d3.1.js"));
But I get the following exception:
Exception in thread "main" javax.script.ScriptException: sun.org.mozilla.javascr
ipt.internal.EcmaError: ReferenceError: "window" is not defined. (<Unknown sourc
e>#5033) in <Unknown source> at line number 5033
at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
at javax.script.AbstractScriptEngine.eval(Unknown Source)
at RJScript.EvalScript(RJScript.java:20)
at RJScript.main(RJScript.java:26)
This same script runs from a browser. Do I need to do something so that the "window" is defined?