Rhino source code (Was: Rhino build support)

Henri Gomez henri.gomez at gmail.com
Thu Nov 10 14:32:48 UTC 2011

For my OpenJDK OSX build, I'll probably follow RH way to include Rhino, ie :

* grab tarball from Mozilla
* update classes name and repackage as rhino.jar
* modify sources files to use this rhino.jar
* update build script
* add rhino.jar to jre/lib
* update runtime to add rhino.jar to bootclass path.

I've done this to test, but jrunscript still complains about missing
sun/org/mozilla/javascript/ContextFactory (included in rhino.jar

Exception in thread "main" java.lang.NoClassDefFoundError:
	at com.sun.script.javascript.RhinoScriptEngine.<clinit>(RhinoScriptEngine.java:67)
	at com.sun.script.javascript.RhinoScriptEngineFactory.getScriptEngine(RhinoScriptEngineFactory.java:74)
	at javax.script.ScriptEngineManager.getEngineByName(ScriptEngineManager.java:243)
	at com.sun.tools.script.shell.Main.getScriptEngine(Main.java:411)
	at com.sun.tools.script.shell.Main.processOptions(Main.java:169)
	at com.sun.tools.script.shell.Main.main(Main.java:44)

os.cpp was modified to add rhino.jar :

bool os::set_boot_path(char fileSep, char pathSep) {
    const char* home = Arguments::get_java_home();
    int home_len = (int)strlen(home);

    static const char* meta_index_dir_format = "%/lib/";
    static const char* meta_index_format = "%/lib/meta-index";
    char* meta_index = format_boot_path(meta_index_format, home,
home_len, fileSep, pathSep);
    if (meta_index == NULL) return false;
    char* meta_index_dir = format_boot_path(meta_index_dir_format,
home, home_len, fileSep, pathSep);
    if (meta_index_dir == NULL) return false;
    Arguments::set_meta_index_path(meta_index, meta_index_dir);

    // Any modification to the JAR-file list, for the boot classpath must be
    // aligned with install/install/make/common/Pack.gmk. Note: boot class
    // path class JARs, are stripped for StackMapTable to reduce download size.
    static const char classpath_format[] =
        // ## TEMPORARY hack to keep the legacy launcher working when
        // ## only the boot module is installed (cf. j.l.ClassLoader)
#ifdef __APPLE__
    char* sysclasspath = format_boot_path(classpath_format, home,
home_len, fileSep, pathSep);
    if (sysclasspath == NULL) return false;

    return true;

Advices welcomed

More information about the discuss mailing list