Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

JRuby 1.5.0 Released: The Best Alternative Ruby Implementation Gets Even Better

By Peter Cooper / May 12, 2010

Following on five months after the release of the popular JRuby 1.4, the JRuby team have delivered JRuby 1.5!

Forgetting the de facto "official" Ruby implementations of 1.8.x and 1.9.1/2, JRuby is the fastest and most stable Ruby implementation available and already has 9 years of progress under its belt. JRuby takes a lot of its performance and versatility from running on the Java Virtual Machine (JVM), which has provided JRuby's developers with a solid base from which to optimize how Ruby is implemented.

JRuby 1.5.0's release notes provide the full detail, but essentially the biggest new features are:

  • Native launcher for UNIX-based platforms
  • Ant support (effectively a Java based built tool, a la make)
  • Rails 3 related fixes
  • Updates to the standard library, RubyGems, and RSpec
  • ruby-debug is now included
  • Significantly improved Windows support (a breath of fresh air for Windows-based Ruby developers used to getting second best in the Ruby world)
  • Overall performance improvements

I don't use JRuby in production myself, but everyone I know who does attests to its stability and performance. I've tried a handful of benchmarks on it informally, and it typically gives Ruby 1.9.1 a run for its money (though not always - and it's worth noting that JRuby's 1.9.x support is still new and optionally applied). It's well worth a try as you might need to pull it out of your arsenal one day to meet the requirements on a "Java-only" enterprise project ;-)

Installing JRuby

Picking up JRuby from its downloads page and getting it running isn't difficult at all, as long as you have a JVM/JRE installed. It comes in both binary and source forms separately for UNIX-esque and Windows environments. Windows users get the bonus of a special "executable + JRE" download for simplified installation.

A far cooler way of installing JRuby, however, is to use RVM (Ruby Version Manager)! With RVM you can install multiple Ruby implementations on your machine without damaging the ones you already have. Creator Wayne E Seguin has already released a new version that supports and installs JRuby 1.5.0. With RVM 0.1.30, installing JRuby 1.5.0 is as easy as:

# rvm install jruby
.. wait a minute or two ..
# rvm use jruby
# ruby -v
=> jruby 1.5.0 (ruby 1.8.7 patchlevel 249) (2010-05-12 6769999) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_17) [x86_64-java]

Comments

  1. Wayne E. Seguin says:

    @haruki_zaemon discovered a little gem left in the distributed 'rake' file so I just released RVM 0.1.31 to address it.

  2. Wojciech Kruszewski says:

    Cool! I never actually used JRuby, but thought having a route towards Java ecosystem opened makes me feel more comfortable with Ruby in general. I love the idea of multiple languages running in the same VM.

    Now only thing I'd need is Heroku for JRuby.

  3. Charles Oliver Nutter says:

    FWIW, with Ruby 1.9.2 looking to go RC or final soon, we're hoping to make a big push in JRuby 1.6 to get the remaining 1.9 behaviors implemented. We don't recommend people use --1.9 more right now, but there are some brave souls doing so and feeding us issues, plus the RubySpec suite has a pretty good complement of tests for 1.9 features. We may not add everything for JRuby 1.6, but we'll add a lot.

  4. Marc Stone says:

    being a jruby-user for about 6 months now I have to say it´s really stable everything works the way you would expect! great work charles!!!

  5. Peter Cooper says:

    Wojciech: One of the cool things, and something I think isn't explained well enough by users or developers alike, is that you don't even need to care about Java or the Java ecosystem one bit in order to benefit from JRuby. I'm reasonably "Java-phobic" and JRuby is crazy easy to get running and is very usable without worrying about Java issues mostly. (Once you get to needing to use JDBC, it adds a little overhead to your thought processes, but it's not particularly difficult.)

  6. Andrew Grimm says:

    Do you mean by "Forgetting the de facto "official" Ruby implementations of 1.8.x and 1.9.1/2" that it's the best apart from MRI/YARV, or that it's faster and more stable than MRI/YARV, analagous to Charlie Chaplin coming second in a look-alike competition?

  7. Peter Cooper says:

    The former. Though.. it gives them a run for their money.

  8. Jason Rogers says:

    We've been using JRuby at RiskMetrics Group since 1.3.x -- it's a great platform. My only complaint is not being able to use native extensions (like libxml, Hpricot, etc.).

  9. Charles Oliver Nutter says:

    Jason: There's a Summer of Code project to get basic C ext support added to JRuby, but in most cases the best options are to provide a Java-native port of the library in question. For libxml there's this:

    http://github.com/dylanvaughn/libxml-jruby

    (and some forks)

    Hpricot should work out of the box; we have a Java port of that that we maintain.

    Others are catch-as-catch-can...Nokogiri has an FFI version that's 100% working, and a Java-native version that's *almost* ready. RMagick has a partial port in rmagick4j. We welcome and will gladly support anybody who wants to port other extensions to JRuby.

  10. Chris says:

    "A far cooler way of installing JRuby, however, is to use RVM (Ruby Version Manager)!"
    There's that "feeling like a step-child when using windows in the ruby world" thing again. I know there's pic, but it doesn't play well with cygwin at all. And to the birds with the windows command prompt. Developing ruby on a windows machine for the last 6 months has really opened my eyes as to just how much the ruby world is -not- windows friendly. Sigh.

  11. mark says:

    I don't really see the advantage of JRuby unless you need to interface with Java. I tried different containers (Jetty, Tomcat, Glassfish) and the JVM requires much more memory. To make matters worse, the speed of JRuby is only realized if you let the JVM warm up after thousands of calls. That's just ridiculous. Let's not forget the incompatibility issues with gems.

    I admire the effort being put into JRuby but, if I need to interface with Java then putting a REST layer around the Java services is more feasible.

  12. Josh Cheek says:

    FYI, if you installed rvm a while ago, might need to first do:
    $ rvm update
    $ rvm reload

  13. Peter Cooper says:

    @Chris: Yep. Check this out too: http://www.rubyinside.com/is-windows-a-first-class-platform-for-ruby-823.html

    Chairing a panel in front of 300 Rubyists and bringing up the Windows concerns while getting a deafening silence back convinced me that there just isn't the will (outside of a few hard working folks). Luckily, I don't use Windows so it doesn't bother me too much though.. :-)

  14. Beatriz A. Arnaez says:

    There's that "feeling like a step-child when using windows in the ruby world" thing again. I know there's pic, but it doesn't play well with cygwin at all. And to the birds with the windows command prompt.

  15. Gordon Thiesfeld says:

    As far as Windows goes:

    C:\>pik install jruby

    .. wait a minute or two ..

    C:\>pik jruby

    C:\>jruby -v
    jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java HotSpot(TM) Client VM 1.6.0_18) [x86-java]

    http://github.com/vertiginous/pik

Other Posts to Enjoy

Twitter Mentions