Jeff Mesnil
Weblog · Dev · Photos · Books

No JavaScript in Java 6 on Mac OS X

May 14, 2008

I had an idea about using JavaScript from Java 6 and I wanted to give it a try on my MacBook.
No such luck: Apple has recently released Java 6 for Mac OS X Leopard but somehow it does not include Rhino, the Mozilla's JavaScript engine bundled in Sun Java 6 release.

Instead they provided only one engine for AppleScript but frankly:

public class AppleScriptTest {
    public static void main(String[] args) throws Exception {
        ScriptEngineManager factory = new ScriptEngineManager();
        ScriptEngine engine = factory.getEngineByName("AppleScript");
        engine.eval("tell application \"Finder\"\n display dialog \"Who cares?\"\n end tell");
    }
}

Nuff said...