What is the difference between Ruby and JRuby?

Can someone provide me in non-professional terms with the difference between developing a JRuby application and Ruby, Rails?

I use NetBeans as my Ruby on Rails environment and every time I create a project, it asks me this question - and I really don't understand. Are there any pros and cons?

+46
ruby ruby-on-rails jruby
Nov 13 '09 at 12:40
source share
8 answers

Ruby runs inside a native C-based interpreter. JRuby runs inside a Java virtual machine. There are many gems and plugins that may not work inside JRuby, in particular with native C extensions, unless they were rewritten to run in Java.

Ultimately, the difference arises when you want to actually deploy your application (assuming that the gems you want to use are not a problem). If you want to deploy it to a java web server, then JRuby is the way to go. If you have a * nix environment, then Passenger + Nginx or Apache is also very popular, which uses a standard ruby ​​or ruby ​​enterprise interpreter. There is always a mongrel or thin cluster option, again using the standard interpreter.

+50
Nov 13 '09 at 12:49
source share

JRuby runs on a Java virtual machine (the interpreter was written in Java), while the original Ruby interpreter was written in C. Both have both up and down (Ruby can use its own extensions, JRuby can access Java types, objects, etc. )

JRuby uses Ruby 1.8.6, 1.9.x syntax to be available soon. JRuby has Java threads (this means that it will scale for many processors, cores, etc.), Ruby has some problems with user-space threading, ec blocking.

Personally, I use JRuby with Glassfish v3 and Netbeans to develop RoR, it scales much better than rubies + loads of mogrels, Apaches and is easier to manage.

+21
Nov 13 '09 at 12:49
source share

Ruby is a programming language. JRuby is an implementation of the Ruby programming language.

The question of the difference between the two does not make sense: they are at two completely different levels of abstraction.

It seems like the question is what is the difference between a car and a Prius. It also does not make sense: Prius is an implementation of the general concept of the car. You might ask what is the difference between Prius and Hummer or the difference between car and airplane, but the difference between car and Prius does not make sense.

Similarly, with Ruby you can learn about the difference between Ruby and Python or JRuby and MRI, but the difference between Ruby and JRuby does not make sense.

+6
Nov 13 '09 at 15:30
source share

JRuby is an implementation of Java Ruby. It is compatible with Ruby 1.8 and lags behind the current Ruby (1.9). It runs on the JVM and makes it easy to integrate existing Java libraries.

+4
Nov 13 '09 at 12:44
source share

JRuby is mostly compatible with Ruby. One aspect of JRuby is that you can run it in incompatible performance reason modes.

+3
Nov 13 '09 at 12:53
source share

As far as I know, jruby is just a ruby ​​implementation written in java, so it makes it easy to integrate with the java environment.

0
Nov 13 '09 at 12:44
source share

JRuby is a Java implementation of the Ruby programming language.

0
Jan 16 '13 at 21:48
source share

JRuby is an implementation of the Ruby interpreter Java interpreter. Rails (aka Ruby on Rails) is a web application platform written in Ruby. This article explains how Ruby code is actually executed through the JVM http://patshaughnessy.net/2012/2/7/journey-to-the-center-of-jruby

0
Feb 22 '16 at 9:39
source share



All Articles