Ruby and Netbeans
There are a host of wonderful features in Netbeans. I'll let you explore those on your own. We likely
won't need them for Ruby, but for Java use, take some time to read up on the features.
I would suggest using Ruby with NetBeans. This means you will need to install both packages. You can
install them separately or together.
NETBEANS AND RUBY TOGETHER
If you install netbeans using "All" you will get Ruby and Java with the package. If you select just
"Ruby", that's what you'll get. I like to use netbeans for Java too, so I downloaded "All".
I used Ruby on Windows, Ruby 1.8.6 One‐Click Installer
Running Ruby Code from Netbeans
Here are the basic features for running Ruby.
To create a Ruby project using Netbeans:
1. File/NewProject Select Ruby and Ruby application
2 . Type a project name, for example, simple_ruby_application, as shown in the next figure.
Browse to a project location of your choice. Leave the "create Main File" selected, but feel free to
3. Click Finish.
The IDE displays the main.rb file in the editor, as shown in the following figure. Notice how the code
calls puts to display the string "Hello World".
4. The Project window shows a logical view of the project files. Click the Files tab to view the physical
layout, then switch back to the Projects window. With Ruby projects, the views are very similar.
5. Right‐click the project node in the Projects Window and select Run. (You can also run by pressing the
green triangle or F6.)
The IDE displays the output in a window at the bottom, as shown below.
This is much nicer than the basic ruby environment (irb) as you can cut and paste. You have to use puts
to see the results ; it doesn't just echo them.
6. If you have multiple projects, you need to "select as Main project" by right clicking on the project
name (from the Projects window) or it will not run the project you expect to be run.
7. When a project contains more than one script, you may want to change the "main script". When you
click the Run Project button ( ), the IDE saves all file changes and runs the main script. I got tired of
creating separate projects for each test, so I created multiple scripts in one project (by right clicking on
the project name and selecting "New/Ruby File". To switch to a different start script, right‐click the
Project node in the Projects window and choose Properties from the pop‐up menu. Select the Run
category and, in the Main Script text field, type the file name.