aspose file tools*
The moose likes Ruby and the fly likes Ruby Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Ruby
Bookmark "Ruby " Watch "Ruby " New topic
Author

Ruby

Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
Hello,

I would like to know more about Ruby and JRuby, specifically what is the difference between the two...and where these languages are ideal to apply?


SCJP2, SCWCD
Michael Sullivan
Ranch Hand

Joined: Dec 26, 2003
Posts: 235
Here is a list of the different Ruby Implementations I've heard of (referenced from Wikipedia):

Ruby or MRI: Matz Ruby Implementation, implemented in C. This is the original Ruby implementation
YARV: likely candidate of Ruby2.0
JRuby: Ruby implemented in Java
IronRuby: Ruby implemented on a .net platform (on top of the CLR using the DLR)
Gardens Point Ruby.net: Ruby on a .net platform (on top of the CLR without using the DLR)
Cardinal: Ruby for the Parrot VM
MacRuby: Ruby 1.9 running directly on top of Mac OS X core technologies
MetaRuby: Ruby based implementation of Ruby, using ruby2c
Rubinius: Implementation of a Ruby VM almost entirely in Ruby


So, to answer your question - the original Ruby implementation is written in C, and JRuby is a ruby port in Java. If you needed to run Ruby on the JVM, or wanted to do so in order to have two-way communication between Ruby and Java - you'd use JRuby.

From JavaWorld

Dynamic languages like Ruby are most commonly used for specialized areas such as gluing other systems together; JRuby takes on this role in the Java world. For example, JRuby can pull data from one system, transform it and insert it into another. When the requirements change, modifying a JRuby script is as easy as changing a configuration file, thereby avoiding the complex compile-and-deploy cycle of Java integration code.

In addition to calling Java from Ruby, you can call Ruby from Java, making your application scriptable. With JRuby's minimal syntactic overhead, you can create an easy-to-use domain-specific language for users to work with (see "Creating DSLs with Ruby" by Jim Freeze). "



Hope that helps!
Jeremy McAnally
Author
Greenhorn

Joined: Feb 09, 2009
Posts: 19
As Michael noted, JRuby is merely an implementation of the Ruby language on the JVM. So, effectively there is no difference, but as always, there will be "artifacts" between the two due to implementation details (f.e., threads perform better but behave a little differently in JRuby).
 
 
subject: Ruby