Develop Ruby Applications Using Eclipse IDE
Eclipse is one of the most popular programming IDEs available today. Very few development environments can stand against it in terms of features or ease of use. Except for editing very small/few number of files, for which the fast responsiveness of the simple editors might be more desirable, Eclipse is becoming the most preferred development environment. Its flexible plugin system has allowed the community to work towards enhancing/adding new functionality to the core product, just like it happened with emacs. The open source license and the plugin system has aslo meant that the IDE today supports most of the popular programming languages making Eclipse far more that just a Java IDE. One such language supported by Eclipse with the support of plugins is Ruby. If you are a Ruby/Rails developer, then you must definitely give Eclipse + Ruby plugin a try.
Download and Install Eclipse
Skip this section if you already have Eclipse installed on your system.
One way to install Eclipse would be to use the appropriate package manager for your distribution like apt, emerge, yum, yast etc. If you want the latest version though, downloading it separately and uncompressing it in the home directory would be an ideal way. In this case, follow these steps:
- Download Eclipse from here.
- Extract the downloaded file in the home directory(say /home/user).
- Make sure atleast the Java runtime(JRE) is installed(complete Java SDK is required to create Java programs from Eclipse) on the system. Go to the extracted directory and run the ‘eclipse’ executable file to check if everything is working properly.
Downloading and Installing Ruby plugin for Eclipse
Follow these steps:
- Download the Ruby plugin for Eclipse by selecting a mirror from here
- Extract the downloaded file in a temporary directory(say /home/user/temp).
- Copy the contents of the extracted directory in the corresponding Eclipse folders:
/home/user/temp/features/* —-> /home/user/eclipse/features/
/home/user/temp/plugins/* —-> /home/user/eclipse/plugins/(Use the path to the Eclipse installation folder if its not installed in the home directory).
- Confirm if the Ruby plugin is successfully installed by starting the eclipse IDE and going to Help->About Eclipse SDK->Plug-in Details.

- Scroll down the list of installed plugins to find the Ruby plugin.

Configure the Ruby plugin
Before being able to create Ruby programs from Eclipse, we need to provide it with the information regarding where Ruby is installed. If Ruby is not already installed, then install it first. Then follow these steps:
- Start Eclipse IDE and go to Window->Preferances->Ruby->Installed Interpreters->Add.
- Enter the following details:
Interpreter Name: ruby
Location: /usr/bin/rubyTo find the location where ruby is installed on your machine, run the following command:
sh# which ruby
/usr/bin/ruby
- Now go to Window->Preferances->Ruby->Ri/rdoc and enter the following information:
RDoc Path: /usr/bin/rdoc
Ri Path: /usr/bin/ri
Fill whatever location you have found out in the earlier step using `which` command.
Creating a Sample Ruby Application From Eclipse
- To create a Ruby application, create a Ruby project from File->New->Project

- Select Ruby->Ruby Project. Click ‘Next’, enter a project name and click ‘Finish’.

- Select File->New->Ruby Class to create a new class or select File->New->File to create a simple Ruby file. Type a program in the editor and save it.

- Now right-click on the file name and select Run As->Ruby Application to run the script.

- You can also debug the Ruby programs from within Eclipse. Click the ‘Debug’ button on the toolbar and select a Ruby script to start debugging it.

The debugger is started and ready.

Other excellent development environments for Ruby application development include Komodo IDE, Emacs, Vim, SciTE etc. I will try to write about these development environments in the next few posts.
- Confirm if the Ruby plugin is successfully installed by starting the eclipse IDE and going to Help->About Eclipse SDK->Plug-in Details.
[...] If RADRails doesn’t capture your fancy and you’d rather use regular Eclipse as your Ruby IDE, Tabrez Iqbal has a great walkthrough of setting up Eclipse and using it to develop Ruby applications along with lots of screenshots and useful information. [...]
[...] Every Flavour Beans » Develop Ruby Applications Using Eclipse IDE (tags: ruby) [...]
hi there,
nice article.
I use Xemacs on windows XP/2000. I run the shell and run irb from within it and another shell for executing a program outside of irb.
It will be nice to see what modes people use X/Emacs with ? Are there pre-built versions that are easy for windows developers ?
thank you,
BR,
~A
hi there,
I got an email saying someone commented on this post — found that it was SPAM.
Good that you guys removed it.
You probably want to send emails to whoever’s subscribed ONLY after confirming that a comment
is NOT SPAM.
thank you,
BR,
~A
I am really sorry for the email you got because of the spam comment posted here. It’s a good point that you have made regarding the plugin’s behaviour regarding sending the email alerts. I will forward your suggestion to the author of this plugin and let’s see what he/she has to say about it.
Thanks for the suggestion.
Hi,
I have been stuck on installing/configuring RDT within my Eclipse IDE. Apparently the RDT plugin has been installed successfully, the files copied on the /features and /plugins directories respectively. I however do NOT see a Ruby section when I got to Windows>preferences in Eclipse. I have attempted the installation/configuration procedure a couple of times as well as used the software updates>find and install approach to no avail. What please am I doing wrong and what can I do? Rails however appear within the preferences window
It is always messy installing the plugins in Eclipse to add more functionality. The software is very sensitive to the version of Eclipse and the versions of the plugins used. I suggest trying the following prepackaged Eclipse IDEs for Ruby and Rails development:
RadRails is only for Ruby and Rails where as EasyEclipse has many flavours to suit different needs. Pick the one that best suits your requirements. Installing additional plugins in EasyEclipse has never given me a problem until now. If you decide to try out EasyEclipse, you must go through the following distribution/plugin chart:
EasyEclipse Distribution/Plugin Chart
thank you for this little tuto, simple &
very useful
and it works (on winxp)
i have read many tuto before as a’m a ruby newbie
most are wrong, brokens links…
i’m happy to try it now
JL
Hi,
I found this info very very useful in helping me instal Eclise and Ruby , and start workin gon it …
Thanks for sharing info. Can you tell me onething Is it possible to debug the ruby program using Eclipse IDE ? Is this have intelisence for program writing ?
Why doesn’t the intellisense work??
I really thankful to you to post such a nice and valuable information. Thanx