---
title: "Jruby on Rails 安装配置"
author: "topgun"
date: "2009-07-29T17:46:37Z"
tags: []
slug: "jruby-on-rails"
draft: false
lastmod: "2009-08-03T09:19:01Z"
id: 435698
url: "https://topgun.iteye.com/blog/435698"
---

# 安装

主要是通过gem 来安装

 

## 先升级一下gems

```
jruby -S gem update --system
```

## openssl

首先安装这个，不然会每次都警告一下

```
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...
```

## 然后装rails

我是遇到问题了：

```
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
```

## sqlite 数据库安装

到这里下载 [http://www.sqlite.org/download.html](http://www.sqlite.org/download.html)

在“Precompiled Binaries For Windows” 栏目里面，分别下载：

[sqlite-3\_6\_16.zip](/admin/blogs/435513/sqlite-3_6_16.zip) 和 [sqlitedll-3\_6\_16.zip](/admin/blogs/435513/sqlitedll-3_6_16.zip)

然后解压到 E:\\ruby\\jruby\\bin

 

# Netbeans

下载最新的nb，我现在是6.7.1

因为这里只想开发rails ，我就只选择安装了rails ，以后运行速度应该会比完全安装快些

## 配置

在“工具”&gt;“ruby 平台” 里面，添加我们安装的最新的jruby （nb 自带的不一定是新的）

ok ，就可以新建一个项目试试玩了

提一点，需要修改数据库配置文件：

 

```
adapter: jdbcsqlite3
```