Error "window" is not defined when loading Protovis from javax.script?
Posted
by Shane
on Stack Overflow
See other posts from Stack Overflow
or by Shane
Published on 2010-04-18T23:44:10Z
Indexed on
2010/04/18
23:53 UTC
Read the original article
Hit count: 499
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?
© Stack Overflow or respective owner