2012-04-15 18:35:23 |
Yuval S |
description |
The packages specifying Rhino support, `com.sun.script.javascript.*`, are missing from OpenJDK 7, though they were included in OpenJDK 6. This causes the `getEngineByName("JavaScript")` call on a `ScriptEngineManager` to return `null` (see my [StackOverflow question for this issue][1]).
Specifically, this code should return `2` but throws a `NullPointerException`:
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();
}
This might very well be the cause of [openjdk-7 bug #920214][2]. According to [Oracle bug #6876736][3], this is indeed a distro bug.
Note that when Rhino was included in OpenJDK 6, it caused package conflicts ([openjdk-6 bug #255149][4], [Debian bug #512970][5]) .
Based on question [#192941][6]
OS: Ubuntu 11.10
OpenJDK version: 7~b147-2.0-0ubuntu0.11.10.1
[1]: http://stackoverflow.com/questions/10054252/trying-to-use-rhino-getenginebynamejavascript-returns-null-in-openjdk-7
[2]: https://bugs.launchpad.net/ubuntu/+source/openjdk-7/+bug/920214
[3]: http://bugs.sun.com/view_bug.do?bug_id=6876736
[4]: https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/255149
[5]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512970
[6]: https://answers.launchpad.net/ubuntu/+source/openjdk-7/+question/192941 |
The packages specifying Rhino support, `com.sun.script.javascript.*`, are missing from OpenJDK 7, though they were included in OpenJDK 6. This causes the `getEngineByName("JavaScript")` call on a `ScriptEngineManager` to return `null` (see my [StackOverflow question for this issue][1]).
Specifically, this code should return `2` but throws a `NullPointerException`:
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();
}
This might very well be the cause of [openjdk-7 bug #920214][2]. According to [Oracle bug #6876736][3], this is indeed a distro bug.
Note that when Rhino was included in OpenJDK 6, it caused package conflicts ([openjdk-6 bug #255149][4], [Debian bug #512970][5]) .
Based on question [#192941][6]
OS: Ubuntu 11.10
OpenJDK version: 7~b147-2.0-0ubuntu0.11.10.1
[1]: http://stackoverflow.com/questions/10054252/trying-to-use-rhino-getenginebynamejavascript-returns-null-in-openjdk-7
[2]: https://bugs.launchpad.net/ubuntu/+source/openjdk-7/+bug/920214
[3]: http://bugs.sun.com/view_bug.do?bug_id=6876736
[4]: https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/255149
[5]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512970
[6]: https://answers.launchpad.net/ubuntu/+source/openjdk-7/+question/192941 |
|