views:

145

answers:

2

What I mean by this is if I install jRuby on Rails, can I use only the ruby language to build my application? I wanted to install my rails application with jRuby in case I wanted to use Java in the future, though I don't need it now. Or do I not understand? Is jRuby ruby that has access to java libraries?

+4  A: 

yes, jruby is ruby (your ruby scripts need no modification to run under jruby). in addition, it has full access to java libraries - check out the wiki for how easy it is to integrate a java class or library into your ruby code.

Martin DeMello
Read how easy it is... and then don't do it. If your goal is to maintain the ability to switch between Ruby and JRuby you should avoid using C extensions in Ruby and java libraries in JRuby.
Matt G
+1  A: 

The others have answered your direct question. I just want to say that I've been using jruby full time at work for the past 6 months and it's great. Deploying a rails app with the glassfish gem is very easy and jruby performs better than MRI ruby 1.8.x.

I've seen no real downside after 6 months other than the fact that we can't use gems that have pieces written in C. However, we've taken a C library and created a gem using FFI and it wasn't too much trouble.

It's also really easy to speed up your app by writing a few key pieces in java (which is easier t work with than C).

jshen