Charles Nutter and Thomas Enebo are on the verge of releasing JRuby version 1.0. The pair are the principal developers of the pure Java-based Ruby interpreter, and they took some time out from the final bug fixes to hold a tutorial at RailsConf in Portland, Oregon: "Your First Day with JRuby on Rails." However, their talk was not focused solely on getting started with JRuby. They also reported on the convergence of a lot complementary technologies from Sun that are supporting Ruby, including NetBeans and Glassfish.
Before diving into the "How To" of JRuby, Charles and Thomas addressed the "Why." As in, why would Ruby developers opt for JRuby over the C-based version that already works for them? First, JRuby provides a foot in the door, getting Ruby into Java-centric organizations that otherwise might balk at a new language or platform. Equally important however, JRuby may convince Ruby developers to adopt the Java platform to take advantage of its scalability and to get at the wealth of Java libraries that provide capabilities that Ruby currently lacks.
They also wanted to assure the audience that one could gain the advantages of the Java platform without deviating from the Ruby Way. JRuby is not an attempt to fork Ruby or future versions won't corrupt it with "improvements." To that end, JRuby 0.9.9 is almost identical to Ruby 1.8.5, and the JRuby install includes all of the same standard libraries that ship with Ruby. Charles pointed out, " We've bent over backwards to make sure that JRuby is as compatible as possible." With the addition of just a few import statements, most pure Ruby gems run fine in JRuby. After demonstrating a standard Rails installation operating as expected, Thomas exclaimed, "Isn't it exciting how boring it is?"
Speed is another potential barrier to adoption, but Charles reported that the current version of JRuby is about on par with Ruby. Previously, JRuby has been purely interpreted code. Over the past few months the team has focused on improving the compiler's ability to handle Ruby syntax. Right now, about 25% of the code in a typical Ruby app can compile. In JRuby 1.0, the compiler runs in a JIT mode, so as running code reaches a certain number of invocations, it will get compiled, after which point the compiled version runs. The goal after the 1.0 release is to continue increasing the amount of JIT compiled code.