如何为Eclipse配置Ruby intepreter

时间:2021-10-06 20:45:29

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

我刚安装了Eclipse的Ruby插件。在创建我的第一个Ruby项目期间,我遇到了选择ruby解释器的问题。

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

我做了New Project => Ruby项目。但是当它要求解释器时,默认是未定义的,在项目特定的解释器下拉菜单中没有显示任何内容,当我点击“配置解释器”链接时,它在我的Web浏览器上打开了一个错误的URL页面。

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

使用什么是正确的解释器以及如何配置ruby解释器?谢谢你的帮助!

7 个解决方案

#1


11  

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:

我在Ubuntu 12.04中的eclipse Indigo中启动了我的ruby项目并遇到了同样的问题。如果你已经安装了ruby并且可以在eclipse中创建一个ruby项目,那么你可以通过以下方式找到/添加解释器:

  1. Go to Window -> Preferences > Ruby > Interpreters
  2. 转到窗口 - >首选项> Ruby>解释器
  3. Click on Search button on the right, then eclipse will help you to find the ruby interpreters
  4. 单击右侧的“搜索”按钮,然后eclipse将帮助您找到ruby解释器
  5. Click OK button at the bottom
  6. 单击底部的“确定”按钮

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

对于我的情况,解释器的位置是/ usr / bin / ruby

#2


2  

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.

请在控制台中键入command whereis ruby​​。如果你得到版本,你会得到/ usr / bin / ruby​​或/ usr / local / bin / ruby​​之类的路径来检查哪个是正确的解释器路径/ usr / bin / ruby​​ -v。那是你的翻译。

With RVM :

Please type command: rvm info

请输入命令: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!

干杯!

#3


2  

Prerequisite: Installation of Ruby

先决条件:安装Ruby

Configuration of Ruby Interpreter in Eclipse:

在Eclipse中配置Ruby解释器:

  1. Open eclipse
  2. 打开日食
  3. Install the Ruby plugin for Eclipse (in my case, it is DLTK)
  4. 安装Eclipse的Ruby插件(在我的例子中,它是DLTK)
  5. Go to Window -> Preferences
  6. 转到窗口 - >首选项
  7. Click Ruby-> Interpreters from left panel
  8. 单击左侧面板中的Ruby-> Interpreters
  9. Click Search... button at right side (Eclipse will help you to find the ruby interpreters)
  10. 单击右侧的Search ...按钮(Eclipse将帮助您找到ruby解释器)
  11. Click OK button at the bottom
  12. 单击底部的“确定”按钮

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

现在您已准备好创建新的Ruby项目并运行。

#4


1  

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.

转到Window-> Preferences。然后,您应该在左侧导航窗格中有一个Ruby选项。选择Ruby-> Installed Interpreters。然后,您应该能够通过添加ruby安装的路径将eclipse指向正确的解释器。

Hope this helps.

希望这可以帮助。

#5


1  

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.

根据您的OS /等,它会有所不同。就我而言,我安装了RVM,即Ruby Version Manager。关键是要将IDE指向Ruby所在的路径。

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.

由于这是一个老问题,我会推断Anisha要么修复它要么放弃了,所以这些信息只供其他人参考。

#6


1  

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

首先打开Ruby透视图,转到Window> Open Perspective> Other并选择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.

要配置Ruby解释器,请转到Window> Preferences> Ruby> Interpreters。单击“添加”按钮>“浏览”按钮,找到并选择Ruby可执行文件ruby.exe,然后单击“打开”按钮。在我的例子中,Ruby位于C:\ Ruby192 \ bin \ ruby​​.exe下。

#7


0  

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.

如果您的系统上安装了Ruby,Eclipse可以帮助您找到ruby解释器的目录。在Eclipse中,选择新项目,然后选择ruby项目,然后在解释器部分选择configure interpreters,在窗口的右侧,点击搜索按钮,Eclipse将在你的系统上找到ruby解释器的版本。然后单击确定。

#1


11  

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:

我在Ubuntu 12.04中的eclipse Indigo中启动了我的ruby项目并遇到了同样的问题。如果你已经安装了ruby并且可以在eclipse中创建一个ruby项目,那么你可以通过以下方式找到/添加解释器:

  1. Go to Window -> Preferences > Ruby > Interpreters
  2. 转到窗口 - >首选项> Ruby>解释器
  3. Click on Search button on the right, then eclipse will help you to find the ruby interpreters
  4. 单击右侧的“搜索”按钮,然后eclipse将帮助您找到ruby解释器
  5. Click OK button at the bottom
  6. 单击底部的“确定”按钮

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

对于我的情况,解释器的位置是/ usr / bin / ruby

#2


2  

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.

请在控制台中键入command whereis ruby​​。如果你得到版本,你会得到/ usr / bin / ruby​​或/ usr / local / bin / ruby​​之类的路径来检查哪个是正确的解释器路径/ usr / bin / ruby​​ -v。那是你的翻译。

With RVM :

Please type command: rvm info

请输入命令: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!

干杯!

#3


2  

Prerequisite: Installation of Ruby

先决条件:安装Ruby

Configuration of Ruby Interpreter in Eclipse:

在Eclipse中配置Ruby解释器:

  1. Open eclipse
  2. 打开日食
  3. Install the Ruby plugin for Eclipse (in my case, it is DLTK)
  4. 安装Eclipse的Ruby插件(在我的例子中,它是DLTK)
  5. Go to Window -> Preferences
  6. 转到窗口 - >首选项
  7. Click Ruby-> Interpreters from left panel
  8. 单击左侧面板中的Ruby-> Interpreters
  9. Click Search... button at right side (Eclipse will help you to find the ruby interpreters)
  10. 单击右侧的Search ...按钮(Eclipse将帮助您找到ruby解释器)
  11. Click OK button at the bottom
  12. 单击底部的“确定”按钮

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

现在您已准备好创建新的Ruby项目并运行。

#4


1  

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.

转到Window-> Preferences。然后,您应该在左侧导航窗格中有一个Ruby选项。选择Ruby-> Installed Interpreters。然后,您应该能够通过添加ruby安装的路径将eclipse指向正确的解释器。

Hope this helps.

希望这可以帮助。

#5


1  

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.

根据您的OS /等,它会有所不同。就我而言,我安装了RVM,即Ruby Version Manager。关键是要将IDE指向Ruby所在的路径。

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.

由于这是一个老问题,我会推断Anisha要么修复它要么放弃了,所以这些信息只供其他人参考。

#6


1  

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

首先打开Ruby透视图,转到Window> Open Perspective> Other并选择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.

要配置Ruby解释器,请转到Window> Preferences> Ruby> Interpreters。单击“添加”按钮>“浏览”按钮,找到并选择Ruby可执行文件ruby.exe,然后单击“打开”按钮。在我的例子中,Ruby位于C:\ Ruby192 \ bin \ ruby​​.exe下。

#7


0  

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.

如果您的系统上安装了Ruby,Eclipse可以帮助您找到ruby解释器的目录。在Eclipse中,选择新项目,然后选择ruby项目,然后在解释器部分选择configure interpreters,在窗口的右侧,点击搜索按钮,Eclipse将在你的系统上找到ruby解释器的版本。然后单击确定。