Technical
Yet Another Jruby And Rails Setup Article

Download/Install Java

Download@

~/.bashrc


export JRUBY_HOME=/home/jruby/jruby-1.0
export JRE_HOME=/home/java_1.5.0_06
export JAVA_HOME=/home/java_1.5.0_06
#no slash at the end :) 
export PATH=/home/jruby/jruby-1.0/bin:/home/jruby/bin:$JAVA_HOME/bin:$PATH
export  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/jruby/jruby-1.0/lib:$JAVA_HOME/lib

Notice, I did not set CLASSPATH since jruby would grab everything in jruby/lib directory and set it to CLASSPATH

JDBC part

Download oracle jdbc driver
and copy it to jruby/lib folder (if you don’t want to bother with CLASSPATH settings.

Install Gems for JRuby On Rails
” crated rails scripts

Everywhere in your ruby script you will need to change env pointer to


#!/usr/bin/env jruby

The most important would rails, and then in your app script/generate and script/server and then again anywhere else where you have env added.

What to change in your app to put JRuby on Rails

config/environment.rb


if RUBY_PLATFORM =~ /java/
  require 'rubygems'
  gem 'ActiveRecord-JDBC'
  require 'jdbc_adapter'
end

config/database.yml

development:
  adapter: jdbc
  driver: oracle.jdbc.driver.OracleDriver
  url: jdbc:oracle:thin:@hostname:port:interfacename
  username: ...
  password: ...

NOTE: it will throw java.sql.SQLException: No suitable driver error if you will have underscore in hostname (host_name for example) so just to make sure that its not the driver that missing but faulty connection string try to use IP address for the host to eliminate possibilities.
I’ve posted ticket about that so hopefully it will attract some attention so people will not have to spend time on silly things, and do the development.

THE END.

Everything else is the same for your app.

Outside links that were helpful and more useful then this one.

JRuby Home JRuby Wiki Article About JrubyOnRails on Jruby Wiki JRuby Repository