When I run the following piece of code, the engine
variable is set to null
when I'm using OpenJDK 7 (java-7-openjdk-i386
).
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public class TestRhino {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
try {
System.out.println(engine.eval("1+1"));
} catch (ScriptException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
It runs fine with java-6-openjdk
and Oracle's jre1.7.0
. Any idea why?
I'm using Ubuntu 11.10. All JVMs are installed under /usr/lib/jvm
.