Teerasej
Teerasej

Reputation: 1536

Can JRuby use original Ruby gems?

I am considering about what is the difference between JRuby on Rails and the original Ruby on Rails for my product?

How does it difference in development activity, deployment, support between its original, or scalability?

I have read many article. They said JRuby is the same function like Ruby. Does it mean we can use Ruby gems for JRuby, using scaffold and ActiveRecord like Ruby, and we can also deploy the product like Java?

Upvotes: 10

Views: 9986

Answers (6)

mahengyang
mahengyang

Reputation: 289

You can read this JRuby description

there is some text about ruby gem and how cloud jruby use them:

Many Gems will work fine in JRuby; however, some Gems build native C libraries as part of their install process. These Gems will not work in JRuby unless the Gem has also provided a Java equivalent to the native library.

Upvotes: 0

lbadura
lbadura

Reputation: 41

You don't have to re-install all your gems for JRuby. All you have to do is to set the GEM_HOME environment variable to the path with your gems. Please also note, that JRuby doesn't support native extensions. So you'll have to find JRuby compatible replacements for gems that use native extensions.

Upvotes: 0

Robert Brown
Robert Brown

Reputation: 11016

See my answer here

Also, this is a handy reference: Is It JRuby

Upvotes: 3

Jim Puls
Jim Puls

Reputation: 81082

Only gems written purely in Ruby will work under JRuby. Gems like RMagick or MySQL or (the standard implementation of) JSON that require C extensions will leave you out of luck in some cases and with alternatives like the JDBC MySQL and JSON-JRuby gems in other cases.

Upvotes: 7

Luke
Luke

Reputation: 3381

JRuby is a full implementation of Ruby, they're the same but JRuby runs on the JVM. It scale very well because you can deploy it inside an application server like Glassfish or JBoss.

You can use Rails of course, there's only one configuration to do, the database adapter. You must install JDBC adapter for ActiveRecord, for example:

gem install activerecord-jdbcmysql-adapter

and in your database.yml

adapter: jdbcmysql

and you're done!

edit:

if you're interested there's a comparison between various Ruby implementations, http://www.infoq.com/presentations/seifer-ruby-vm-comparison and JRuby is one of the best implementation.

Upvotes: 0

kgiannakakis
kgiannakakis

Reputation: 104168

Most, but not all, Ruby gems are also available for JRuby. Scaffold and ActiveRecord can definitely be used with JRuby. You won't find any RoR functionality that is missing from the JRuby on Rails.

With JRuby you can deploy your application as a standard WAR. If you do not know for sure if you want to use native Ruby or JRuby, I recommend that you use Netbeans IDE. With it you can easily switch from native Ruby to JRuby for Rails applications.

Upvotes: 0

Related Questions