开发者

How to configure Ruby intepreter for Eclipse

I just installed the Ruby plugin for Eclipse. During creating my first Ruby project I fall into problems selecting the ruby interpreter.

I did New Project => Ruby project. But when it asked for an interpreter, the default was undefined, nothing showed up on the project-specific interpr开发者_如何学JAVAeter drop-down menu and when I clicked on 'Configure Interpreters' link it opened up a bad url page on my web browser.

What is the correct interpreter to use and how to configure ruby interpreter? Thanks for your help!


I started my ruby project in eclipse Indigo in Ubuntu 12.04 and have the same problem. If you installed ruby already and can create a ruby project in eclipse, then you can find/add interpreters by the following way:

  1. Go to Window -> Preferences > Ruby > Interpreters
  2. Click on Search button on the right, then eclipse will help you to find the ruby interpreters
  3. Click OK button at the bottom

For my case, the location of the interpreter is /usr/bin/ruby


Without RVM :

Please type command whereis ruby in console. you will get the path like /usr/bin/ruby or /usr/local/bin/ruby to check which is correct interpreter path /usr/bin/ruby -v if you get version. that is your interpreter.

With RVM :

Please type command: rvm info

binaries:
    ruby: "/home/<USERNAME>/.rvm/rubies/ruby-2.0.0-p247/bin/ruby"

copy this path and paste wherever you need enter you interpreter path.

It worked for me. and I hope it will help others as well.

Cheers!


Prerequisite: Installation of Ruby

Configuration of Ruby Interpreter in Eclipse:

  1. Open eclipse
  2. Install the Ruby plugin for Eclipse (in my case, it is DLTK)
  3. Go to Window -> Preferences
  4. Click Ruby-> Interpreters from left panel
  5. Click Search... button at right side (Eclipse will help you to find the ruby interpreters)
  6. Click OK button at the bottom

Now you are ready to create new Ruby project and run.


Go to Window->Preferences. You should then have a Ruby option in the left navigation pane. Select Ruby->Installed Interpreters. You should then be able to point eclipse at the correct interpreter by adding a path to the ruby install.

Hope this helps.


On my system:

thufir@dur:~$ 
thufir@dur:~$ which ruby
/home/thufir/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
thufir@dur:~$ 
thufir@dur:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"
thufir@dur:~$ 

It will be different depending on you OS/etc. In my case, I installed with RVM, the Ruby Version Manager. The point is to point the IDE to the path for wherever Ruby is.

Since this is an old question, I'll infer that Anisha either fixed it or gave up, so the info is just for others to reference.


First open Ruby perspective, go Window > Open Perspective > Other and select Ruby.

To configure Ruby interpreter, go Window > Preferences > Ruby > Interpreters. Click Add button >Browse button, locate and select your Ruby executable ruby.exe, and click Open button. In my case Ruby is located under under C:\Ruby192\bin\ruby.exe.


If you have Ruby installed on your system, Eclipse can help you to find the directory of ruby interpreter. In Eclipse, choose new project, then ruby project then in the interpreter section choose configure interpreters, in the right hand side of the window, hit search button, Eclipse will find the version of ruby interpreter on your system. then click ok.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜