主要是通过gem 来安装
jruby -S gem update --system
首先安装这个,不然会每次都警告一下
C:\>jruby -S gem install jruby-openssl JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed jruby-openssl-0.5.1 1 gem installed Installing ri documentation for jruby-openssl-0.5.1... Installing RDoc documentation for jruby-openssl-0.5.1...
我是遇到问题了:
C:\>jruby -S gem install rails ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) SystemCallError: Unknown error - ??¨???????????????è?????????????????????· ??????????è???????? (http://gems.rubyforge.org/gems/activeresource-2.3.3.gem)
不过解决的办法非常简单,重新在试,不知道是不是网络的问题,运气好两三次,不好就十几次,反正最后都能装成功:
C:\>jruby -S gem install rails Successfully installed activeresource-2.3.3 Successfully installed rails-2.3.3 2 gems installed Installing ri documentation for activeresource-2.3.3... Installing ri documentation for rails-2.3.3... Installing RDoc documentation for activeresource-2.3.3... Installing RDoc documentation for rails-2.3.3...
如果有遗留项目,可以安装多个rails 版本
C:\>jruby -S gem install -v=2.3.2 rails
这次错误更频繁,处理这个问题的方法就是把gem 下载到本地安装:
E:\TDDOWNLOAD>jruby -S gem install activeresource-2.3.2.gem Successfully installed activeresource-2.3.2 1 gem installed Installing ri documentation for activeresource-2.3.2... Installing RDoc documentation for activeresource-2.3.2...
E:\TDDOWNLOAD>jruby -S gem install activerecord-jdbcsqlite3-adapter E:\TDDOWNLOAD>jruby -S gem install activerecord-jdbcmysql-adapter
到这里下载 http://www.sqlite.org/download.html
在“Precompiled Binaries For Windows” 栏目里面,分别下载:
sqlite-3_6_16.zip 和 sqlitedll-3_6_16.zip
然后解压到 E:\ruby\jruby\bin
下载最新的nb,我现在是6.7.1
因为这里只想开发rails ,我就只选择安装了rails ,以后运行速度应该会比完全安装快些
在“工具”>“ruby 平台” 里面,添加我们安装的最新的jruby (nb 自带的不一定是新的)
ok ,就可以新建一个项目试试玩了
提一点,需要修改数据库配置文件:
adapter: jdbcsqlite3