Enterprise, RIA/Web 2.0, and I.T. Management Solutions

Home / Expertise & Services / Featured / Flex & Flash / RIA Development / Technologies / Tutorials / Cairngen with Flex Builder 3 Eclipse Plugin on Mac OSX Leopard

At Excentrix Web, we are avid users and proponents of Open Source Software (OSS).  Consequently, we are always looking for “what’s out there” instead of “reinventing the wheel”: we do this in order to increase ROI for our clients’ projects.  When we decided to port a fairly complex Flex project to Cairngorm we decided to find something to help us avoid doing the initial coding of our stubbed classes by hand…Enter stage-right Cairngen!

We love Macs so naturally all our dev machines are Mac OSX Leopard.  However, there have been times when we’ve been stung with intermittent compatibility issues between vanilla OSS-based projects and Leopard.   One of those times was today when we attempted to get our Cairngen build working inside of the Flex Builder 3 Eclipse plugin IDE.  (We practice what we preach with OSS so we do our Flex Builder dev in Eclipse.)  We thought it would be simple to just right click on the build.xml, select “Run as -> Ant Build”  and “voila!” Cairngen would work its magic…Well, that expectation was shot down quickly.

We noticed two errors.  The original was:

1) “Unable to load a script engine manager” and…

After going down the path to resolve error #1 by downloading, installing, and configuring the Mac OSX  JRE 1.6.0 with Eclipse we started receiving the next error:

2)  java.lang.UnsatisfiedLinkError: no swt-carbon-3349 or swt-carbon”

Doing further trouble-shooting of error #2 we figured out that error #2 resulted from the fact that JRE 1.6 does not work with the carbon-swt because Apple’s release of JRE 1.6 is purely 64-bit AND not backwards compatible with 32-bit based carbon-swt.

Through our trial and error we were able to get Cairngen working right.  Simply take the following steps and your Cairngen will work:

    • Download Cairngen from http://cairngen.googlecode.com/files/cairngen-2.1.1.zip
    • Go to this page, http://code.google.com/p/cairngen/wiki/GettingStarted, to learn how to get Cairngen into your Eclipse Flex Builder 3 project
    • Configure your Ant Home to point to the Ant 1.7 release:
      *Go to Eclipse -> Preferences -> Ant,
      *Expand “Ant” and then click on “Runtime”
      *Under “Classpath” click on “Ant Home Entries” and then click on the button “Ant Home…”
      *Navigate to where the root of your Ant 1.7 directory is then hit the “Choose” button
    • Once your Ant Home is set, download the following jars’ zip files (the following is thanks to contributor “Darren” on Eric Feminella’s blog here):
      *BSF: http://jakarta.apache.org/site/downloads/downloads_bsf.cgi
      *Mozilla Rhino: http://www.mozilla.org/rhino/download.html
      *Commons-logging: http://commons.apache.org/downloads/download_logging.cgi
    • Extract the zips to your Mac’s java directory (I put any 3rd party, non-Apple-sponsored jars under /opt/local/share/java/)
    • Go back to your Eclipse IDE, and once again get to your Ant configuration (refer back to step #3), then do the following once you see the Ant “Runtime” screen again:
      *Click on “Global Entries” then click the button “Add External JARs…”
      *Navigate to and select your jar
      *Repeat the previous steps for each of the jars downloaded in step #4
      *Hit “Apply” and then “OK”
    • Quit and restart Eclipse

      You should now be able to right-click on Cairngen’s “build.xml’ file and select “Run As -> Ant Build” and everything will run like a charm!

      Share and Enjoy:
      • Facebook
      • FriendFeed
      • Twitter
      • LinkedIn
      • Suggest to Techmeme via Twitter
      • Google Bookmarks
      • Reddit
      • Digg
      • del.icio.us
      • Slashdot
      • DZone
      • StumbleUpon
      • Yahoo! Bookmarks
      • Yahoo! Buzz
      • Live
      • MSN Reporter
      • NewsVine
      • Simpy
      • Blogosphere News
      • Sphinn
      • Linkter
      • Mixx
      • BlinkList
      • blogmarks
      • BlogMemes Fr
      • RSS
      • Print this article!
      • E-mail this story to a friend!

      2 Responses to “Cairngen with Flex Builder 3 Eclipse Plugin on Mac OSX Leopard”

      1. KrisBelucci Says:

        Hi, good post. I have been wondering about this issue,so thanks for posting.

      2. reagLurge Says:

        Hi, Congratulations to the site owner for this marvelous work you’ve done. It has lots of useful and interesting data.

      Leave a Reply