Why was Rhino support (com.sun.script.javascript.*) removed between OpenJDK 6 and 7?

Asked by Yuval S

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]) .

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

Revision history for this message
Yuval S (yuval-s) said :
#1

P.S. `rhino.jar` with all classes is readily available in OpenJDK 7, but the script engine wrappers are missing.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#2

I suggest you report a bug

Revision history for this message
Yuval S (yuval-s) said :
#3

I'm not sure if this is a bug. I would think someone removed it intentionally. Either way, if I open a bug it'd be a duplicate of https://answers.launchpad.net/bugs/920214.

Revision history for this message
Marko Stanković (sm4rk0) said :
#4

Fix released, for both related bugs mentioned here.

Can you help with this problem?

Provide an answer of your own, or ask Yuval S for more information if necessary.

To post a message you must log in.