What's the difference between Ruby and JRuby?

Ash picture Ash · Nov 13, 2009 · Viewed 29.8k times · Source

Can anyone please provide me in layman's terms the difference between developing a JRuby and a Ruby, Rails application?

I use NetBeans as my Ruby on Rails IDE and every-time I create a project is asks me that question - and I don't really get the difference. Are there any pro and cons?

Answer

danivovich picture danivovich · Nov 13, 2009

Ruby runs within a native C based interpreter. JRuby runs inside the Java Virtual Machine. There are many gems and plugins that might not work inside JRuby, specifically one's with native C extensions, unless they've been rewritten to run in Java.

Ultimately the difference comes in when you want to actually deploy your application (assuming the gems you want to use weren't an issue). If you would like to deploy to a java web server, then JRuby would be the way to go. If you have a *nix environment, then Passenger + Nginx or Apache is very popular as well, which uses the standard ruby or ruby enterprise interpreter. There is always the mongrel or thin cluster option as well, again using the standard interpreter.