Rob Prime wrote:Then it should reuse that engine, and its state. As you can see from the code I've edited it evaluates laks.length just fine in the second call to eval.
You're right, when I run your code as a testcase (through
JUnit), it works as expected. The engine implementation returned by
manager.getEngineByName("js") is a
com.sun.script.javascript.RhinoScriptEngine.
However, I get a different implementation of the ScriptEngine in my web server environment. Looks like that implementation doesn't keep variables. Have to look into that, I guess.
Thanks for the help, it's good to know I wasn't too far off.