JRuby is a 100% Java implementation of the Ruby programming language. It is Ruby for the JVM. JRuby provides a complete set of core "builtin" classes and syntax for the Ruby language, as well as most of the Ruby Standard Libraries. The standard libraries are mostly Ruby's own complement of .rb files, but a few that depend on C language-based extensions have been reimplemented. Some are still missing, but we hope to implement as many as is feasible.
The easiest way to get up and running with JRuby is to download the latest binary, extract it, and add the directory to your PATH environment variable.
To test whether JRuby installed correctly, open a command window or terminal window and run: jruby -v
bash$ jruby -S gem install rails mongrel jdbc-mysql activerecord-jdbcmysql-adapter
bash$ jruby -S gem install jruby-openssl
bash$ jruby -S gem install jruby-rcov --source http://gems.github.com
bash$ jruby -S gem install hpricot --version '~>0.6.1'
Warble is what takes a Rails app, and turns it into a .war file that can be dropped into most any Java container. We will install it on the JRuby side. Warble comes with an executable script called “warble” that will be available in your terminal. Install warbler by issuing:
bash$ jruby -S gem install warbler
To create an application type in:
bash$ jruby -S rails APP_NAME --database mysql
There are some configuration files that you may need to know:
Now, we need to populate the databases for development and production:
bash$ mysqladmin -u root create app_development
bash$ mysqladmin -u root create app_production
bash$ jruby -S rake db:migrate
bash$ jruby -S rake db:migrate RAILS_ENV=production
Creating the WAR file: