After complaining in my previous post, here is a more constructive guide to use JavaScript with Apple’s Java 6 VM:
- Download JSR 223’s engines
- Copy
jsr223-engines/javascript/build/js-engine.jarto/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ - Download Rhino
- Copy
rhino1_7R1/js.jarto/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/
You can now use a “JavaScript” engine from Apple’s Java 6 VM:
public class JavaScriptTest { public static void main(String[] args) throws Exception { ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); engine.eval("print('hello, world!')"); } }
jrunscript is also working:
$ cd /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/ $ ./jrunscript rhino-nonjdk> print("hello, world"); hello, world rhino-nonjdk>

October 30th, 2008 at 15:20
Thanks so much for posting this, this had me scratching my head for half a day.