Ruby for Eclipse正確配置方法介紹
Ruby語言是一項簡介實用的腳本語言。在這里我們會了解到一些Ruby for Eclipse的正確安裝配置方法。希望對大家有所幫助。#t#
有時間要多了解了解
http://www.ruby-lang.org/zh_CN/documentation/ 幫助文檔
---以下安裝配置轉載
一、安裝Ruby for Eclipse前的準備工作:
1. 下載Ruby:http://www.ruby-lang.org/en/downloads/
2. 下載RDT(Ruby Development Tools) for Eclipse:http://sourceforge.net/project/showfiles.php?group_id=50233
3. 下載RadRails for Eclipse:http://update.aptana.com/install/rails/3.2/
建議大家盡量把所有插件都下載回來再安裝,原因很簡單,用Eclipse的New Remote Site安裝時經常會因為網絡問題安裝不下去。下載下來再安裝就方便多了。
二、安裝Ruby for Eclipse環境及插件:
1. 安裝Ruby解釋器:直接雙擊下載下來的EXE文件,按安裝向導安裝即可;
2. 安裝Rails:在CMD窗口中輸入以下命令"gem install rails --include-dependencies";
2. 安裝RDT插件:在Eclipse>Help>Software updates>Find and install...>Search for new feature to install>New local Site下,選擇RDT插件的解壓目錄,按向導指示安裝插件;
3. 安裝RadRails插件:在Eclipse>Help>Software updates>Find and install...>Search for new feature to install>New local Site下,選擇下載的文件,按向導指示安裝;
三、配置Ruby for Eclipse環境:
1. 我使用的Ruby版本是1.86,Eclipse版本是3.3.1,安裝完成基本上不用再做任何配置,打開Eclispe>Windowns>Preferences>Ruby>Installed Interpreters,可以看到缺省已經設置了JRuby做為虛擬機;
2. 如果你希望使用原生的Ruby做為虛擬機,則可以點擊“Add”按鈕設定Ruby的運行目錄。到此時設置即告完成,不必像先以前的版本那樣設置其它的系統路徑。
四、Hello Ruby:
1. 選擇菜單Eclispe>New>Project>Ruby>Ruby project,建立一個Ruby工程“HelloRuby”;
2. 在新建的Ruby工程上右擊鼠標,選擇New>Ruby Class,建立一個新的Ruby類,類名為HelloRuby;
3. 在新類中寫入下列代碼,Hello Ruby就完成了。在工程上右擊菜單Run as>Ruby Application即可輸出結果。
class HelloRuby
print "Hello Ruby!"
end