Installing NetBeans with Ruby / Rails support

February 28, 2007

NetBeans LogoAs stated in my blog, I am having a look at the most well-known Ruby / Rails IDE competitors.
Thus I had a try on NetBeans after seeing screenshot and features from Tor’s weblog, and after having played in Java with UML Module from NetBeans which I found good, I’ll blog about that later…
So, version we will install :
NetBeans 6 Daily Snapshot (I tried from 20070211 to 20070221). For the moment Ruby support is only available for early adopters in the snapshot releases. It was released lately as 6.0 Milestone 7 (and you’ll wait for M8 for some more features)

. Modules I installed (with version I have at the moment) :

  • Common Scripting Language API/Support 0.13.0/
  • Embedded Ruby 0.10.0, JRuby Implementation 0.92.3, Rake-Based Project Support 0.10.0, Ruby IDE Support 0.16.0, Ruby On Rails 1.16.0, Ruby on Rails Project Support 0.13.0, Ruby Projects

But latest releases with some more fix/features come with :

  • Common Scripting Language API/Support 0.14.0/
  • Embedded Ruby 0.11.0, JRuby Implementation 0.92.4, Rake-Based Project Support 0.10.0, Ruby IDE Support 0.20.0, Ruby On Rails 1.1600.0, Ruby on Rails Project Support 0.16.0, Ruby Projects

You should notice that NetBeans doesn’t show up when you’re running Beryl on Linux, after switching back to KDE Windows Manager you’ll be able to see the window (You can switch back to Beryl Window Manager after), this a known issue with Java (either 1.5 and 1.6) and Beryl.
Once you installed NetBeans Snpashot (or M07), you’ll need to install the Modules :
– Tools / Update Center / Development Update Center (If you don’t have it available you didn’t download a snapshot release).

NetBeans Install Ruby Plugin

After that for some older version of the module you would need to chmod properly the executable from the plugin directory but this has been fixed here.

When you will try to create a rails project directly after NetBeans install and plugin-install you would end with the error :
rubygems.rb:301:in `report_activate_error': Could not find RubyGem activesupport (= 1.3.1) (Gem::LoadError)
The gems activesupport and activerecord are missing, I found it rather strange as I had them installed on my machine.
In fact NetBeans Ruby Module is using an embedded JRuby, that come with some gems (rails, actionmailer…) used for your future NetBeans Ruby / Rails projects. I wonder why activesupport and activerecord have not been included, but anyway with our project we will need to complete this rubygems repository. It’s important to get that well set as it will be scanned and some features like autocompletion will be based on it.

There is an option in Tools / Options / Miscellaneous / Ruby Application to configure Ruby binaries used by the module.

NetBeans Tools / Options / Miscellaneous / Ruby Application

Still options won’t be saved on Windows, you have to manually edit \.netbeans\dev\config\Preferences\org\netbeans\modules\ruby\project.properties to point to your binaries :
ie, for me :

Congratulations! You are ready, you can relaunch NetBeans and enjoy!
At first launch, the plugin will index Ruby SDK and gems thus taking some minutes.

You’ll find Project Mailing List here.

[EDIT] You can ignore the following workaround as it seems to be corrected with latest versions of the Module since I reported it.[EDIT]

The path property file under windows windows will fail to save (~/.netbeans/dev/config/Preferences/org/netbeans/modules/ruby/project.properties), on Linux it will manage to save it but will simply ignore it. I submitted an issue on that. I also asked to add rubygems repository path configurable here.

So as a temporary workaround, we can handle this problem two ways :

  • Solution 1 : Find a way to make JRuby use our already existing rubygems repository and other bins like rails…
  • Solution 2 : Install libraries we need for our project development in JRuby environment (you can have a look here for Multiple Gem Repositories handling)

We can discriminate the install with OS :

  • Linux :
    • First Solution
    • First you’ll need to export $JRUBY_HOME, if you installed NetBeans Ruby module as user (and not global) it should be something like ~/.netbeans/dev/jruby-0.9.2 else it will be placed in a folder in the NetBeans installed directory : {$ROOT_INSTALLED_NETBEANS}/nb6.0/jruby-0.9.2.
      export JRUBY_HOME=~/.netbeans/dev/jruby-0.9.2
      Backup in case of.
      mv $JRUBY_HOME/lib/ruby/gems $JRUBY_HOME/lib/ruby/gems.backup
      Find on your system where is located the ruby gems repository (use find or locate), mine is /usr/lib/ruby/gems/ and make a symbolic link pointing to it :
      ln -s /usr/lib/ruby/gems/ $JRUBY_HOME/lib/ruby/gems

    • Second Solution (shouldn’t be used… in the future)
    • First you need to add JRuby to your path else it will complain
      /usr/bin/env: jruby: No such file or directory
      Point to the directory from NetBeans install if you installed the module as Global
      export PATH=$JRUBY_HOME/bin:$PATH
      Finally Install the exact versions it requested.
      $JRUBY_HOME/bin/gem install activesupport -v 1.3.1
      $JRUBY_HOME/bin/gem install activerecord -v 1.14.4

      The plugin comes with rails 1.1.6 for the moment.
      You can update it aswell if you wish (not obliged) but keep the other dependencies integrate (you can use –include-dependencies)
      $JRUBY_HOME/bin/gem update rails
      You should act like this for any thirdparty library install you need in your environment.

  • Windows :
  • I don’t know if the trick of symbolic link is possible under windows, so I decided to do it the second way :
    Go to the place you installed NetBeans (if you chose to install the module as global) and find JRuby home, or go to your user directory (if you chose user install), and execute :
    gem.bat install activesupport -v 1.3.1
    gem.bat install activerecord -v 1.14.4

    You should do like this for any thirdparty library you need.


  1. Hi Sauvray,
    Thanks for documenting these issues in detail.

    The activesupport/activerecord issue was a simple bug related to the build script which produced bits for the update center (which is why I didn’t notice it, because I build from source). A bug was filed on this and fixed – it should work if you fetch the latest from the update center now (although I’m not sure exactly what the build schedule is – it was integrated more than 24 hours ago but on the other hand, the daily build for all the optional modules sometimes doesn’t complete and has to be restarted if any of the components are broken.). See http://blogbeebe.blogspot.com/2007/02/ruby-development-support-advancing-in.html
    for an entry related to this issue.

  2. I am not sure if this is a related problem: I am running ordinary ruby, Rails 2.02, Windows Vista, Netbeans 6.0.1. I am trying to connect to PostgreSQL8.3 — However, when I try rake db create all I get is an error message indicating that the ruby postgres gem is not found. I have however installed it from the tools menu and it is listed as installed.

    It can also be found here:

    Error message+ top of stack:
    ** Invoke db:create:all (first_time)

    ** Invoke environment (first_time)

    ** Execute environment

    ** Execute db:create:all

    rake aborted!

    182: The operating system cannot run %1. – C:/Rails/ruby/lib/ruby/gems/1.8/gems/ruby-postgres-


    C:/Rails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require’

    C:/Rails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require’

  3. You’re sure you’re pointing NetBeans to your own ruby path and not the NetBeans bundled jruby one ?

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 )

Google photo

You are commenting using your Google 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

%d bloggers like this: