JRuby is a project to watch for. It implements Ruby on Java virtual machine. In other words now Ruby is truly cross-platform. More importantly it allows strong inter-operability between java classes and ruby scripts.

JRuby allows Ruby code to easily call Java classes and vice versa. Invoking a java class from Ruby is as simple as:

require 'java'
include_class 'java.util.Random'
r = Random.new
puts r.nextInt

Key Differences

  • JRuby uses Java threads instead of Ruby specific "green" threads.
  • JRuby doesn't guarantee that integers returned by Object#id are unique.

Limitations

  • It hasn't yet ported RoR to JRuby. It is slated for March 2006.
  • Finalizers are not implemented.
  • It is somewhat slower than native C implementation.
  • It cannot load ruby external modules (native shared libraries) .