I am trying to run Protovis javascript from a Java program using javax.script
:
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.eval(new java.io.FileReader("protovis-d3.1.js"));
In order to run this, the JavaScript engine needs to have all the context of a web browser. The best option for this seems to be envjs. Unfortunately it seems that the version of Rhino included in the JVM isn't up to date and doesn't include everything that's necessary for envjs.
Has anyone had any success working with a browser context from javax.script, or am I missing something?
This is related to this question: "Can I create a ‘window’ object for javascript running in the Java6 Rhino Script Engine".