The divas talk about the new and cool features of the NetBeans IDE
Insider Scoop From the Tutorial Divas
Archives
« January 2010
SunMonTueWedThuFriSat
     
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
      
Today
XML
Search



Recent Entries


Links

 


Today's Page Hits: 281

Tag Cloud: ajax creator dataprovider dropdown glassfish jasperreports javaone jmaki jruby jsc jsf netbeans photohunt rails ruby table vwp
« Quick Note about... | Main | Our NetBeans Ruby... »
Monday Dec 08, 2008
Fixing the Rails requires RubyGems >= 1.3.1 Error

Many of you who are trying out the NetBeans IDE Ruby support are running into the following error message:

Rails requires RubyGems >= 1.3.1 (you have 1.2.0). Please `gem update --system` and try again.

This is not a NetBeans error message. It is generated by the Rails framework. This error message happens if you upgrade to Rails 2.2.2.

To compound the frustration, it seems that the suggested command gem update --system does not work on all versions of Ruby Gems. When you try the command, you get a message that there is nothing to update. Fortunately, there is a work around.

Here is one way to fix this Rails/Ruby Gems version mismatch. If you have more than one Ruby installation (for example, you have the JRuby that is installed with the IDE and you have a separate MRI Ruby installation), you need to run the command for each installation. Note that the path to the bundled JRuby bin directory is <netbeans-install-dir>/ruby2/jruby-1.1.4/bin.

In the following steps, replace ruby with jruby if you are updating your JRuby installation.

  1. Open a terminal window and change (cd) to the JRuby or Ruby bin directory.

  2. Type ruby -S gem --version

    If the version is 1.3.1, then that installation has already been updated and you are done. Otherwise, continue.

  3. Type ruby -S gem install rubygems-update

  4. Type ruby -S update_rubygems

  5. To ensure that the update happened, type ruby -S gem --version

Posted at 11:45AM Dec 08, 2008 in Ruby  |  http://blogs.sun.com/divas/entry/fixing_the_rails_requires_rubygems  |  Permalink  |  Comments[8]
del.icio.us | furl | simpy | slashdot | technorati | digg

Comments:

Not sure... I've installed the new Netbeans 6.5 in two computers and both gave that error.

Also, both fixed updating the platform going to Tools > Ruby Gems > Manage... > Autodetect Platforms

I don't know why it wasn't detecting the native Ruby, but doing this, the native ruby interpreter will appear in the list and then you just have to select it.

Posted by Edgar J. Suárez on December 09, 2008 at 08:33 AM PST #

Really helpful, thanks. I'm running NB on Vista and there is a .bat file doing the job >update_rubygems.bat

Posted by Per Öberg on December 09, 2008 at 11:59 PM PST #

Some more notes, at least for my noob install attempt on Windows7:
Before accessing the command prompt, first the "system properties"->"advanced"->"environment variables"->"system variables"->"new" button must be clicked to add a path for JAVA_HOME to link back to the JDK at C:\Program Files\Java\jdk1.6.0_11

The command prompt has to be run as administrator.

Then the jruby commands actually work!

Posted by arriflex on January 15, 2009 at 02:15 PM PST #

I was excited to see this hint since I suddenly am getting this error after upgrading Rails.

But when I try to follow the steps with JRuby, it fails, giving me an exception just trying to execute jruby:

./jruby -S gem --version
Exception in thread "main" java.lang.NoClassDefFoundError: org/jruby/Main

I was able to follow the steps for the native Ruby, but not for JRuby (on Mac OS X Leopard in case that matters)

Posted by Rob Weaver on January 28, 2009 at 09:20 AM PST #

Hi Rob,

Very curious. What version of the JDK/JRE is in your path?

Posted by Chris Kutler on January 28, 2009 at 09:43 AM PST #

Looks like the answer to my issue may be found here: http://wiki.jruby.org/wiki/FAQs#Under_OSX_I_get_this_error_when_trying_to_execute_jruby:__Exception_in_thread_.22main.22_java.lang.NoClassDefFoundError:_org.2Fjruby.2FMain

Did a cd .. and executed the following:

./bin/jruby -S gem --version

Apparently you can't run JRuby from the bin directory.

Posted by Rob Weaver on January 28, 2009 at 11:42 AM PST #

Thanks Rob for posting the solution. Very much appreciated.

Posted by Chris Kutler on January 28, 2009 at 11:56 AM PST #

Thanks, this worked like a charm!

Posted by Michael on February 18, 2009 at 07:45 PM PST #

Post a Comment:
Comments are closed for this entry.