The J Plugin: Existing Rails Apps on JRuby

I am giving a JRuby presentation at the No Fluff, Just Stuff Symposium in St. Louis this weekend. With the recent announcement of JRuby 0.9.8, I am sure the first question on everyone's mind is "When will JRuby be production ready?"

To me, the only way to answer this question is to run some real apps in JRuby, and see what problems arise. However, most of the tutorials out there assume a green field application. That is unrealistic for enterprise developers like myself. We have dozens of existing Rails applications to support.

So, I set out to write a plugin that would let an existing Rails application run either in native Ruby or JRuby. I have open-sourced the result. You can add the J plugin to your Rails application with

  script/plugin install

J is very simple. Currently it only works with MySQL Rails apps, and only in *nix shell environments. Once you install it, all you do is

  rake j:setup
See the j.rake file and README for more usage info. Here's what I can tell you so far, having pointed J at three real-world web applications:

  • One of the three UIs ran correctly immediately. With the other two, I have uncovered different library behaviors between JRuby and native Ruby. I will take these over to the JRuby mailing list and report back on the solutions.
  • Testing tasks do not run, because Rails' databases.rake does not handle JDBC drivers yet. This should take only a few hours work, and I am hoping that someone has done it already.
All in all, I would say we are very close. Once we hammer out the few issues above, we can start continuous integration for our Rails development across both native Ruby and JRuby. Sweet.

Get In Touch