In the wake of our recent announcement of JRuby support, we have a guest post from Charlie Nutter of the JRuby team on getting starting with JRuby:
“Last week, Engine Yard announced they would soon support running JRuby in their cloud environment. I think I speak for the whole JRuby community when I say how excited we are about this new possibility. JRuby has proven itself a top-notch, production-quality Ruby implementation, and the Engine Yard announcement really made us feel proud of what we’ve accomplished. It also got us thinking about what JRuby really means for Engine Yard customers.
JRuby is, simply put, Ruby on top of the Java virtual machine. While this means you get the benefits of the JVM’s world-class garbage collectors, libraries, and optimizations, it does not mean you have to know Java to use JRuby. We’ve worked very hard to make JRuby look and feel “just like Ruby.” So much so, that these days basically all pure-Ruby libraries should “just work” out of the box. Rails runs great, and there’s dozens of production users out there reaping the benefits of JRuby’s outstanding memory management, native threads (actually running in parallel!), and excellent performance…all of which we continue to improve with every release. JRuby at Engine Yard means you’ll also be able to take advantage of Engine Yard Ruby and Rails expertise, along with the assurances that your application will “just work” in their cloud.
So how do you get started with JRuby? Easy!
- Download JRuby from http://www.jruby.org. JRuby 1.3.0 is the current release, but you can feel comfortable testing out either 1.3.0 or 1.2.0: the previous release several folks already have in production.
- Unpack it somewhere convenient. You don’t have to install it as root, but you can if you like. And you can have as many separate JRuby installs as you want, alongside any standard Ruby installs already on your system.
- Put JRuby’s “bin” directory somewhere in your PATH, so you can run the “jruby” command easily.
That’s it! You’re ready to try it out!
Depending on how you have your PATH set up, you can either run “gem” to install RubyGems (if JRuby’s “gem” comes earlier in the path than standard Ruby), or you can run “jruby -S gem” to force JRuby’s copy to run (this will work for anything else in JRuby’s bin dir, too). A few gems you’ll probably want to know about:
- Rails works great! Just “gem install rails” or “jruby -S gem install rails” and you’re nearly there.
- ActiveRecord is also well-supported in JRuby, but you’ll need to install the JDBC-based (Java’s DB API) adapters. So for mysql, you want “gem install activerecord-jdbcmysql-adapter” and “jdbcmysql” as your adapter type in database.yml. For sqlite3 there’s “activerecord-jdbcsqlite3-adapter”, and so on.
- Gems that have native extensions (C code, usually indicated by RubyGems trying to build something on install) will not work in JRuby. Usually there’s an equivalent library, either a port of the C version, a wrapper around the actual C library, or a Java version. jruby.org provides a good list of commonly-used extensions and their equivalents on JRuby, or you can check isitjruby.org to see if your favorite extension is supported or has an alternative.
We’ll be publishing more information about how to get up and running with JRuby, especially if you have native dependencies, over the next couple weeks. And of course you can join the JRuby mailing lists or visit our IRC channel #jruby on FreeNode any time. There’s never been a better time to try JRuby!”

Very excited to see JRuby support on Engine Yard!
JRuby-on-Rails applications run seamlessly on GlassFish – as a Gem or as a WAR. Multiple tips are available at: http://blogs.sun.com/arungupta/tags/rubyonrails+t...
[...] first stop should be either my previous Engine Yard blog post on Getting Started with JRuby or the JRuby home site at jruby.org. You’ll find instructions on how to download, install, [...]
This post really should be called "Converting to JRuby". It's not about getting started, this is for Ruby developers that already use Ruby on other platforms.
For those that are looking to get started with Ruby, using JRuby, this post really doesn't contain much info. E.g. sample code, "hello, world". All the things you expect on a getting started page.
Is JRuby just a secondary platform for Ruby, as this post implies? Or is it a reasonble place to start learning about Ruby development?
Curious: Yes, what you say is true; this is more an "intro to JRuby for Ruby folks". But that is largely the point…up until this point, Ruby and Rails are just Ruby and Rails, regardless of whether you are on JRuby or not. We've made it a key point of JRuby that Ruby should "just work", so any tutorial you'd follow to get a Ruby or Rails application working should work the same on JRuby as it does on any other Ruby.
You are correct, though. We on the JRuby team need help selling "Ruby" to the non-Ruby masses. We're so close to Ruby that we forget (or at least don't address the fact) that Ruby itself requires a bit of selling at times. Most of our presentations and posts are focused on people who have already decided Ruby is the way to go. Hopefully as JRuby continues to gain momentum, we'll see more folks from the Ruby world selling to non-Ruby developers, and since many of those developers are using JVM-based libraries and languages, JRuby will be a natural progression.