Friday, March 09, 2007

Running JRuby built from the trunk with Netbeans 6.0

It's nice to use software in development. It's also nice to use it with an excellent IDE. What fun then that you can use easily use Netbeans 6.0 to both build and develop with the absolutely latest version of JRuby. Here's how.
  1. First you need to get Netbeans 6.0. You can download the dev build from Netbeans.org. NOTE: you currently need to get Milestone 6 or above so choose Netbeans Version "6.0" and Build Type "Daily". Get the latest "IDE" product.
  2. When it's downloaded, double click and install...
  3. You're not ready to go yet. You need to connect to the update centre in order to get the Ruby support. Click on Tools -> Update Center to start the process.
  4. From the available list of options select all the Ruby elements and install them.
  5. Now you need to get the lastest JRuby source. To do this you need to set up Subversion to point to the project's repository. Click on Versioning - Subversion - Checkout...
  6. Enter the JRuby trunk repository URL: svn://svn.codehaus.org/jruby/trunk/jruby and click "Next", and wait...
  7. When the code is checked out and Netbeans has scanned the classpaths it will ask you if you want to open the project. Answer in the affirmative.
  8. We're almost there. Now we need to build JRuby. To do this right click on the Ant icon in the "Projects" pane and select "build". Ant will build everything for you.
  9. Now set two environment variables. The first, a new one called JRUBY_HOME which should point to your base JRuby directory. Then add $JRUBY_HOME/bin to your path (%JRUBY_HOME%\bin on Windows)
  10. Time to get Rails. Open a command prompt and type: gem install rails -y --no-ri --no-rdoc
  11. Finally you need to point Netbeans at your JRuby binaries. Select Tools - Options. Select the "Miscellaneous" tab and expand the "Ruby Installation" node. Point each of the items at the binaries in your JRUBY_HOME\bin directory
That's it. Try creating a new Ruby project and then running it. You're off!

No comments: