Running Ruby Java Bridge on Windows

The Ruby Java Bridge (RJB) is one of the most useful Ruby integration packages available. For example, RJB enables the complete use of the Chemistry Development Kit (CDK) from within Ruby. Past articles have been written from a unix-centric perspective. This article will show how Windows users can join in the fun.


The only software you'll need for this tutorial is Sun's Java Development Kit (JDK). RJB requires the JDK and won't work with Sun's Java Runtime Environment (JRE).

Install Ruby and RJB

The simplest way to get started with Ruby on Windows is to download and install the Ruby One-Click Installer. Be sure RubyGems support is enabled.

Once Ruby is installed, RJB can then be installed by using the RubyGems packaging system (from a dos prompt - see below):

sudo gem install rjb

Choose the most recent Win32 version (1.0.2 at the time of this writing). This will automatically compile and install RJB on your system.

If you'd like, now would be a good time to also install Ruby CDK (rcdk):

gem install rcdk

Post-Install Configuration

You'll need to make sure your system's JAVA_HOME environment variable points to your JDK installation. If you're running Windows XP, a convenient way to do so is to use Start->Control Panel->(Switch to Classic View)->System->Advanced Tab->Environment Variables. Add a new variable called JAVA_HOME with the path to the JDK installation as a value. On my system, this path is C:\Program Files\Java\JDK1.5.0_09. Simply installing JDK does not set your system's JAVA_HOME environment variable.

Testing RJB

You can verify that RJB is installed and working as described in my previous article on RJB. A command line prompt can be obtained in Windows XP through Start->Run followed by typing and enter. The screenshot below shows RJB working via IRB:

Ruby RJB

Summing Up

Using Ruby and RJB on Windows is not that much different than doing so on unix. With this background, future articles will return to the theme of Ruby's role in chemical informatics software integration.