Getting Started With NetBeans Ruby 6.5

Now that I have most of the online help done for NetBeans Ruby 6.5, I can start updating the tutorials. I have already started getting comments from customers who are discovering that the 6.1 tutorials don't work with 6.5, so I thought I should quickly blog about known differences. The main reasons these tutorials don't work with 6.1 are: (1) Rails upgrade from 2.0.2 to 2.1 and (2) the addition of the GlassFish server. I am still learning about the 6.5 changes and enhancements, so I probably won't get them all listed here. If you find something that I didn't catch, please add a comment.

Installing and Configuring Ruby Support

The GlassFish V3 Prelude application server is now included with the Ruby bundle. If you are starting from a fresh install, it will be the default server. When you run your Rails apps using the GlassFish server, the URL will be different than if you run with WEBrick or Mongrel. The port is 8080 and you include project name in the URL. (There is an option in the JRuby tab of the server's properties dialog box to Deploy All Rails Applications at Root Context, so if you don't want the project name in the URL you could change that configuration. However, you can have problems if you have more than one Rails application deployed to the server if they have similar routes.).

For the information about Using Database Servers With JRuby, I suggest that you go to If you are using the generic Active Record JDBC adapter and you select the Access Database Using JDBC checkbox, the IDE puts the appropriate driver in the classpath for you, providing that the database server has been registered with the IDE and the IDE knows the driver's location. If you are running the application with the GlassFish server, and you are using SQLite (or a database server that stores its databases in files), you have to edit the database.yml file to specify the full path to the database, such as

database: /usr/local/sqlite/var/rubyweblog_development.sqlite

Now that GlassFish V3 is included, you can run with GlassFish for your development, test, and production environments. The IDE now uses Warbler instead of Goldspike. If you select the Add Rake Targets to Support App Server Deployment, and you don't have the Warbler gem installed, the New Project wizard forces you to go all the way to the last step, where you can click a button to install Warbler.

Getting Started With Ruby and Rails

With Ruby applications, the concept of a "main" project doesn't apply anymore. If you click the Run Project button in the main toolbar, the IDE runs the current project. To see what the current project is, look in the IDE's title bar. I typically right-click the project's node in the Project window and choose Run project, because that way I don't have to think about which of my open projects is current.

If you are using Rails 2.1.0 (The Bundled JRuby comes with Rails 2.1.0), you need to edit the Configuration > initializers > new_rails_defaults.rb file. Find the two lines that start with ActiveRecord::Base and comment them out. Supposedly, in the next Rails release, this code will only be executed if active record is defined, but for now, you have to comment out the lines.

In Step 7 of Create the Model Class, you paste some code into the item.rb file. In that code, replace this line:


with this line:

DATA_FILE = RAILS_ROOT + "/data.yml"

The original code won't work when you run in the GlassFish server, because it relied on the server running in the working directory.

In Step 8 of of Run the Application (for the Rails project), use the X button that appears in the left side of the server's tab in the Output window. While there is also an X button in the bottom right for the WEBrick server, this button does not appear for the GlassFish server. On the other hand, the X button is in all the server output windows.

In Step 9 of Run the Application , there is no longer a "main" project for Ruby projects. So, click the Run Project button if the title bar shows that your Rails application is the current project, or right-click the project's node and choose Run.

Creating a Ruby Weblog in 10 Minutes

In the Creating the Database section, you now choose Run/Debug Rake Task, which opens the Rake Runner. Type db:c in the Filter text box to narrow down the list of tasks. Double-click db:create to run that task.

In step 3 of Creating the Database section, you will see that the file name has changed. Instead of using a sequence number prefix (as in 001_create_posts.rb), the Rails script used a timestamp prefix (something like 200808152345453_create_posts.rb). To learn more about why Rails did this, see Brent's blog entry about timestamp based migrations.

As mentioned earlier, when you run the Rails application with the GlassFish app server, the URL uses 8080 as the port and includes the project name, such as http://localhost:8080/rubyweblog/.

In Step 6 of Adding Another Table Column, the code that is generated for Rails 2.1 looks a little different. You can either copy and paste what is provided in the tutorial, and which still works, or you can duplicate the lines as explained in the step and replace both instances of :title with :body, and replace text_field with text_area as shown below.

    <%= f.label :body %><br />
    <%= f.text_area :body %>

Do the same as above for new.html.erb.


hi there,

I downloaded the installer for windows and the installer hung. So, I tried the second time and this time, the installer warned me that there was a 2nd instance and not to try 2 simultaneous instance. However, I persisted and asked it to go ahead BUT it hung.

then, I tried rebooting my xp box and try again. Same result.

what is the fix ?

thank you,


Posted by anjan bacchu on August 15, 2008 at 04:53 PM PDT #

Anjan Bacchu,

I suggest that you write about this to the nbusers mailing list so that the installer engineers will see it. You should tell them which Windows operating system you are using and which download are you installing (Ruby-only or All or the MySQL bundle). Also tell them what version of the JDK is on your system.


Posted by guest on August 16, 2008 at 02:49 AM PDT #

To find the nbusers mailing list, go to

Posted by diva#2 on August 16, 2008 at 02:51 AM PDT #

Anjan did write to nbusers, and they pointed him to

The problem might be caused by large zip files in the desktop.

Another known installer issue is getting a blank window on Ubuntu. NetBeans users tell me that installing JDK 6 update 10 is a better work around than what the release notes recommend.

Posted by diva#2 on August 18, 2008 at 02:44 AM PDT #

Post a Comment:
Comments are closed for this entry.



« June 2016