Hi,
Since you didn't give full sample code, I wrote this:
import javax.script.*;
public class Main {
public static void main(String[] args) throws Exception {
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine engine = m.getEngineByName("nashorn");
engine.eval("age = 5");
System.out.println(engine.get("age"));
}
}
It compiled and ran as expected.
-Sundar
On Monday 10 March 2014 06:23 PM, Walter Higgins wrote:
Hi,
In JRE6/7 I can run code like this...
scriptEngine.eval(' age = 5 ');
... but in Nashorn the following fails ( ReferenceError) ...
eval( ' age = 5' );
Is there a way to make the native eval() function provided by Nashorn not
be so strict?