E4X: Mac OS X Setup

E4X, mentioned earlier, is an XML processing extension for JavaScript. It’s available for Rhino, the Mozilla implementation of JavaScript in Java. Here’s how to get to it from the shell in Mac OS X.

  1. Download Rhino (as of this writing) 1.6R2.
  2. Download Apache XBeans.
  3. Uncompress both archives.
  4. Create, if you don’t have it already, ~/Library/Java/Extensions.
  5. Copy js.jar from Rhino, xbean.jar and jsr173_1.0_api.jar from XBeans’ lib folder to ~/Library/Java/Extensions.
  6. Open a terminal window.
  7. Go to the E4X examples folder in the Rhino download.
  8. Run java org.mozilla.javascript.tools.shell.Main e4x_example.js.

Thanks to Todd for the tip about putting jar files in ~/Library/Java/Extensions to automatically add them to your classpath.

And thanks to a commentor at Bob Foster’s blog for clarifying that you need jsr173_1.0_api.jar in your classpath as well.

More like this: , .

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*