Appendix B. JRuby
JRuby is an implementation of the Ruby language that runs on the Java Virtual Machine (JVM). The main benefits of using JRuby are the ability to mix Ruby and Java code, the performance benefits gained from running on the JVM, and the ability to deploy web applications to Java servers like Tomcat and J2EE. This appendix provides an overview that will help you get started exploring the many facets of JRuby.
The steps required to install JRuby are the same on all operating systems. First, make sure you have Java installed and that the java command is accessible from the path. Next, download the most recent version of JRuby available from dist.codehaus.org/jruby, expand the archive to a directory of your choice, and set the path to point to the bin directory that contains the various JRuby executables (jruby, jirb, etc.). Verify that JRuby is installed correctly by running jruby --version from the command line.
For example, on Linux you could download and install JRuby 1.1.2 like this:
To run Ruby programs using JRuby, use the jruby command:
You can also use jirb, the JRuby Interactive Interpreter, the same way you would use irb (see appendix A for instructions on how to install Wirble).