Using javax.script to run javascript with browser settings (e.g. envjs)?
- by Shane
I am trying to run Protovis javascript from a Java program:
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.