JRuby is now able to run a basic Ruby on Rails program.
and i wonder: why bother?
please don’t get me wrong. i agree that technically it’s a great achievement to run such a complex Ruby application on a JVM. what i don’t understand is this:
what’s the point of running these things on the JVM?
now, i don’t have much JRuby experience, but i’ve worked with Jython a while and i assume their position/goals are basically the same. please correct me if i’m wrong.
i can understand when you create a JVM port of a language when you want to interact with the JVM. for example you’d like to call some java libraries etc.
an other reason might be application-scripting: because Java is such a rigid programming language, these JVM ports (Jython,JRuby) are often used as scripting languages for java applications: means that you write your application in java, and then use Jython/JRuby to control that application.
but to be able to run a Ruby on Rails application?
why would anyone need it?
i don’t think there’s a significant hardware platform where java runs but Ruby does not. then why don’t you just run your application in normal Ruby?
sometimes people argue that: This is great, at my company we can only use java. with this i’ll be able to write my applications in Ruby, and my company will be also fine with this, because i can run it on a JVM.
but this is wrong. if your company only allows java, it’s not just because they are deploying on a JVM. it’s also the language. that the company standardized on java, so if they recruit a new programmer, or an other programmer has to take over your code, it’s enough if he knows java. i don’t think they would be happy to have one more programming language jump in. and on the other hand, if they are willing to accept one more programming language, they will probably be also willing to accept a new runtime, so you can just install Ruby.
another argument is J2EE: This is great, we are only developing J2EE applications. now with JRuby i’ll be able to put my Ruby application into an EJB (Enterprise Javabean) container.
this is also wrong. to be able to put something into a J2EE container, the java application has to face some VERY serious restrictions. for example it cannot use threads. so now what to do with Ruby apps that use threads? to put this simple: it’s not possible to just take a Ruby application, and “integrate” it into an EJB container. (p.s: to be absolutely correct: yes, there are some ways in some EJB containers to disable some of these restrictions. but i don’t think your company is very happy about disabling those restrictions (and thereby decreasing the stability of the container) just for that one RoR app. and as i said, in some containers. and it’s not standard)
then why?
please tell me a single scenario, where it’s better to run a RoR application on a JVM than to run it directly in Ruby.
Comments
There are many compelling
There are many compelling reasons to run Rails on the JVM. A few:
Anyone who has developed apps for the JVM or for J2EE understands the benefits those platforms offer. Rails helps mitigate some of their detriments.
That said I won’t say it’s a “better” option just yet. JRuby still needs work, but this shows how far we’ve come. Eventually you will be able to run Rails on JRuby as well as on regular C Ruby, and for anyone that has time and resources invested in existing JVM-based servers, this will provide a way for them to run Rails without any additional investment.
With Rails running on the
With Rails running on the JVM I can start deploying Rails apps at work while still supporting our older JSP/servlet apps. Once everything has been moved over to RoR I can set up our production server environment for only Ruby/rails.
This is a good stopgap measure for those in the middle of a migration.