Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7791229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:49:19+00:00 2026-06-01T21:49:19+00:00

When I run the following piece of code, the engine variable is set to

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:49:20+00:00Added an answer on June 1, 2026 at 9:49 pm

    [Update: This was a bug, which has now been fixed]

    In short, this might be a bug.

    Rhino support classes (com.sun.script.javascript.*) are not compiled into rt.jar1 (though I found references to this being a merging issue between Sun and Mozilla, and I know there have been namespace issues, they do exist in the OpenJDK 7 source and are referenced in the makefile), and they’re missing from resources.jar‘s META-INF/services as well. This is not the case with OpenJDK 6, which has this as a META-INF/services/javax.script.ScriptEngineFactory entry:

    #script engines supported
    
    com.sun.script.javascript.RhinoScriptEngineFactory #javascript
    

    Though this might be a distro decision2 there is no written reason for it, so I filed a bug #982501 in the Ubuntu OpenJDK 7 launchpad. Will give a better answer once I get one.

    1 according to this thread,

    I had heard somewhere that Mozilla didn’t accept Suns changes into their
    mainline branch for reasons unknown but that was prior to being opensourced.

    There have also been some collision issues caused by conflicting versions of JRE and a BYOR (bring-you-own-Rhino) version (e.g. bug #255149 on Ubuntu OpenJDK 7 launchpad). However, the source is in the OpenJDK 7 source and mentioned in the makefile, and BSD port, mentioned in the above thread, has identical sources.

    2 According to this Sun bug #6876736, this is to a distro-based decision:

    The rhino sources are not part of OpenJDK, it is up to the distros to add it.

    Somewhat in contrast to the fact that they’re checked in to the OpenJDK mercurial, but I think the idea is that Rhino is not in the JDK spec.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A newbie question. I have the following piece of Java code: import acm.program.*; import
I have the following piece of code that I'm expecting to run on a
I'm using the following piece of code in Android to send a mail: Intent
The following piece of code #include <iostream> #include <vector> #include <tuple> using namespace std;
I am using the following piece of code to get results from DB as
When I run the following code piece, a IndexOutOfRangeException is thrown. It appears that
I have the following piece of code which is being run from a click
when I trying to run following code. var result = from c in db.brand
When I run the following code to test copying a directory, I get a
The following piece of code was given to us from our instructor so we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.