Before you start
Ruby on Rails (Rails) is a full-stack Web application framework written in Ruby — a feature-rich, free, simple, extensible, portable, object-oriented scripting language. Rails has gained immense popularity among Web application developers. With it, you can quickly and efficiently develop a Web application and deploy it into any Web container, such as IBM® WebSphere® or Apache Tomcat.
Before Rails and similar Web application development frameworks were available, the de facto standard tool for the job was the Java language, thanks to its platform independence and comprehensive API set. Many Java Web applications are still running, resulting in the ready availability of much useful, well-written Java code (loosely referred to in this tutorial as legacy code). Legacy Java code is usually packaged as a set of JAR files.
If you change your Web application development platform to Rails, you can reuse legacy Java code. The Ruby Java Bridge (RJB) is a toolkit that lets you load JAR files into your Rails application and access the methods and variables in them. This tutorial explains how to configure and use RJB in a Rails application.
In this tutorial, you will learn how to:
- Download, compile, and install RJB
- Set up RJB to access shared Java libraries
- Load and access legacy Java code in a Rails application
The tutorial does not delve deeply into the capabilities of Rails. One of Rails' many strong points, compared to other Web frameworks, is the quality and quantity of documentation available for the platform (see Resources).
This tutorial assumes basic familiarity with the Java language, Ruby, and Ruby on Rails.
This tutorial assumes that you are working on a Linux® system. (However, the steps are essentially the same for Windows®.) It also assumes that you have a working setup of Ruby on Rails. If not, see Resources for links to documentation that can help you install and configure Rails for your system.
RJB requires that you have a Java SDK installed on your system. If you need to, download the latest Java SE SDK for your platform and install it now.

