views:

162

answers:

3

I have downloaded and compiled the newest version of Rhino by going

ant compile
ant jar

When I run it like so I get the following error

java -jar js.jar
    Rhino 1.7 release 2 2009 05 12
    Exception in thread "main" java.lang.NullPointerException
        at org.mozilla.javascript.Kit.classOrNull(Kit.java:92)
        at org.mozilla.javascript.tools.shell.ShellLine.getStream(ShellLine.java:65)
        at org.mozilla.javascript.tools.shell.Global.getIn(Global.java:829)
        at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:385)
        at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:196)
        at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:117)
        at org.mozilla.javascript.Context.call(Context.java:515)
        at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
        at org.mozilla.javascript.tools.shell.Main.exec(Main.java:179)
        at org.mozilla.javascript.tools.shell.Main.main(Main.java:157)

Also $JAVAHOME points to /usr/lib/jvm/java-6-sun

A: 

Do you really mean $JAVAHOME? Or do you mean to say $JAVA_HOME?

Drew Wills
Right, it's `$JAVA_HOME` on my system too.
Ivan Nevostruev
I meant JAVA_HOME
DevDevDev
+1  A: 

There's a bug in that version of rhino that affects some versions on Linux. It fails when trying to load the jLine library (for command-line editing and completion). There's a patch that fixes the problem and was merged into CVS at https://bugzilla.mozilla.org/show_bug.cgi?id=495785. Unfortunately, I think jLine support will be broken, since it's not finding the class loader.

Matthew Crumley
A: 

Java 6 is shipped with a JS api based on Rhino. Check it out.

PS: It works darn well.

Ravi Wallau