3

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?

johnny
  • 19,272
  • 52
  • 157
  • 259

2 Answers2

4

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
  • 11,876
  • 7
  • 49
  • 64
  • 2
    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 May 22 '09 at 23:27
1

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
  • 11,507
  • 7
  • 37
  • 59