Thursday, February 1, 2007

JRuby enters the home stretch for Rails support

Posted by rick

We’re on the home stretch now, and Rails is getting more and more solid every day. With you all helping, we should be able to finish off the remaining failures, clean up major outstanding JRuby issues, and kick out a pretty sweet “Rails-supporting” JRuby release in the next couple weeks. — Charles Nutter

I’m not a Java guy by any means, but I don’t think anyone disagrees that this is great news. Why? The idea of dynamic languages on the JVM is very appealing, even Ryan Tomayko thinks so.

Now, being a recovering C# programmer, I had no idea how to get JRuby installed and running. So, here’s a quick newbie guide for you Mac OSX users. If you have good instructions for other platforms beyond what’s in the JRuby blog, please post or link to them in the comments. Also, be sure to use the proper reporting channels for any bugs you come across: the Rails Trac for Rails bugs, and JRuby’s JIRA for JRuby issues.

  • First, you need java. Luckily, it happens to ship with Tiger. “java -version” tells me I have v1.5.0_06. Awesome.
  • I actually set this up over the weekend, and used ‘ant test’ to build and test JRuby. This required me to install JUnit to proceed. I just created a directory to act as my CLASSPATH, and threw junit-4.1.jar in there.
  • Set up a few environment variables (see below for the list).
  • Add /path/to/jruby/bin to your PATH.

export CLASSPATH=/path/to/junit-4.1.jar
export JRUBY_HOME=/path/to/jruby
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
export JRUBY_SHELL=/bin/zsh

After this was done, I was able to run jruby or jirb directly. Depending on where you add the jruby/bin path, you may or may not be using the JRuby gem script or not. Use ‘which gem’ to check.

There you go, you should be all ready to help the JRuby folks out.