JRuby is similar to the standard Ruby interpreter except written in Java. JRuby features some of the same concepts, including object-oriented programming, and dynamic typing as Ruby. The key difference is that JRuby is tightly integrated with Java, and can be called directly from Java programs.
What is Ruby on Rails? Ruby on Rails is also an open source development tool, but it is not a scripted language. Rails is used primarily as a web application development framework and is based on the Model View Controller (MVC) architecture.
Ruby is an object oriented scripting language launched in 1995. Ruby on Rails is a web app development framework based on MVC system. 02. It is known as a general purpose programming language.
If you are using an application that will stay alive for long, and you want better runtime support, JRuby can be a great way to go. Otherwise, you can safely wait until you need these things to actually make the move (it is likely to go smoothly). Excellent answer, that's exactly what I needed to know.
JRuby is the Ruby implementation that runs on a JVM whereas Matz's Ruby is a C implementation.
Key features to note are:
There are other differences which are listed at the JRuby wiki:
I'm surprised there's a crucial thing missing in all answers to this question, related to GIL.
The main difference you should care about esp. in web-applications such as ones built with Rails is true concurrency ("Global Interpreter Lock" free). When two threads are running (e.g. serving 2 user requests) with JRuby they are capable of running concurrently within a single process, while in MRI there's the GIL (even with 1.9's native threads) that avoids executing Ruby code in parallel.
For an application developer this is the first thing to keep in mind while considering JRuby, as it really shines with config.threadsafe!
but requires you to make sure your code (and your gems code) to be "truly" thread-safe.
I may be wrong, but I think you can package a JRuby on Rails app in a way you can't do with normal RoR - look at Mingle or similar. Makes it possible to sell without dropping your pants / opening the komono.
That said, I'm not familiar enough with RoR packaging, so dont hold me to it :)
mostly it should work the same. in jRoR you can access stuff you wouldn't have in RoR. Usually its mainly a deployment concern.
However, if your RoR app uses native libraries that don't have an equivalent that runs on the JVM, that can be a pain. However most libs have a non native version available (at least the popular ones I have come across).
There are some great answers here already.
eebbesen already covered the basics, and kares (himself!) has told us JRuby has no GIL.
I'll add from a more practical perspective, I've launched apps on Ruby on Rails, and then migrated to JRuby for performance reasons.
There were two main performance benefits: JRuby is (or was) simply faster than Ruby in some circumstances, and two, the lack of the Global Interpreter Lock kares mentions allowed me to do multithreading, which, while tricky, unlocked orders of magnitude performance benefits.
A very large Ruby on Rails app ported and ran in an hour, gems and all. The only actual glitch was that Java's regexes are slightly different than Ruby's. That's a monumental achievement on JRuby's part.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With