setting up specific version of JRuby and Rails with Netbeans 6.5

To add a custom Ruby platform in Netbeans 6.5 (in my case updating from the included JRuby 1.1.4 to JRuby 1.2) :

Install the desired version of JRuby

  • Download Ruby 1.2.0 from jruby.org
  • Extract the zip file to c:\ruby\jruby-1.2.0
  • Test it out by going to the c:\ruby\jruby\1.2.0\bin directory and running ‘jirb’
    (It seems this will only work on Windows if you’re in the bin directory)
  • You can install gems with ‘jruby gem install foo’

Add the new version of JRuby to Netbeans

  • Click on Tools -> Ruby Platforms
  • Click “Add Platform” and navigate to the ruby.bat file.
  • Navigate to the c:\ruby\jruby-1.2.0\bin\ folder and select ruby.bat
    (only the ruby.bat file will work on windows)

Netbeans_Ruby_Platforms

Load and update packages from Netbeans

  • click on Tools -> Ruby Gems
  • To update, select the “Updated” tab
    To Install, select the “New Gems” tab
  • (not the most intuitive, but easy enough to figure out.)

Netbeans_Ruby_Gems

My real gripe is the forced network calls that interrupt the application.  In Netbeans 6.1, your whole IDE was frozen, at least in 6.5 you can hit the “Close” button and cancel the extremely slow package refresh and get back to work.

Because of this, I prefer to load my gems from the command line, especially if you want a different version than the latest.

Load and update packages from the command line

  • cd C:\ruby\jruby-1.2.0\bin
    (don’t forget, you have to be here, or mess with your path)
  • jruby gem update –system
  • jruby gem install rails -v=2.1.2
  • jruby gem install jruby-openssl
    (to get rid of that annoying, but harmless message)

Install previous version of a gem in Netbeans

  • Click on Tools -> Ruby Gems
  • Click on the “Installed Gems” tab
    (note that if you installed gems from the command line, you have to click “Reload Gems” to see them in Netbeans.)
  • Enter a seach term to narrow down the list
  • Click on the “Settings” tab
  • Check “Fetch All Gem Versions”
    (don’t do this before you have a sufficiently narrowed down list or it will take forever.  Unfortunately, if you search for “rails” you see about a hundred packages and all their versions, and this could take hours to load.)

Netbeans_Ruby_Gems_Settings_Tab

Create a new Rails project using my selected versions

  • Click File->New Project
  • Select Category: Ruby
  • Select Projects type: Ruby on Rails Application

Netbeans_Rails_Project

  • Click Next
  • Select JRuby 1.2.0 from the Ruby Platform
  • Netbeans_Rails_project_configComplete the project creation by selecting the Database connection
    (I installed the jdbc-mysql and activerecord-jdbc-mysql gems, and then created the database manually.)

Netbeans_Rails_DB_connection

  • and selecting the rails version
    (optionally installing Warbler and JRuby_OpenSSL Support)

Netbeans_Rails_Project_4

2 thoughts on “setting up specific version of JRuby and Rails with Netbeans 6.5

  1. Netbeans will accept regexp when filtering the packages. This will help limit your hundreds of rails choices to the one you want with ^rails$ .
    Thanks for the info, helped me find what I needed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s