JRuby is a Ruby language interpreter that is written in Java. This means that it runs Ruby programs under the JVM and, therefore, runs portably anywhere that Java runs (which is nearly everywhere).

I used to think that the killer feature of JRuby was making it easier to sneak Ruby into companies via a Java back-door. But that was before I saw Charles Oliver Nutter’s JRuby presentation earlier this week at the St. Louis Gateway JUG. JRuby’s killer feature is its brilliant integration with Java code. Ruby code can call Java code (and vice versa) and Ruby classes can inherit from Java classes.

A really nice touch is that JRuby will let you call Java methods using standard Ruby conventions. This is especially nice for getters and setters, where you can take Java code that looks like this:

   MyThing thing = new MyThing("blob");
   thing.setName(thing.getName() + "_title");

And write it in Ruby style like this:

   thing = MyThing.new("blob");
   thing.name += "_title";

This also means that your Ruby code has direct access to that vast universe of Java code. Peter Cooper just wrote about his experiment using JRuby to create a cross-platform desktop GUI application using the same SWT framework that renders Eclipse. Cool stuff!