# Rails and JRuby

**URL:** <https://www.ruby-forum.com/t/rails-and-jruby/84881>\
**Category:** Rails\
**Created:** [March 21, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/rails-and-jruby/84881 "2006-03-21T20:15:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 21, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/rails-and-jruby/84881/1 "2006-03-21T20:15:46Z")

</div>

Has anyone attempted to run Rails inside of JRuby?

Is that even possible?

Aside from the performance implications, is it a bad idea?

I’m thinking that it might be useful in very rare cases where a  
Ruby/Rails - equivalent of a Java solution may not exist yet.

Any thoughts?

Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 21, 2006, 8:38pm UTC](https://www.ruby-forum.com/t/rails-and-jruby/84881/2 "2006-03-21T20:38:14Z")

</div>

JRuby isn’t a complete Ruby implementation. It won’t work. Apart from  
other things using c libraries is not possible.

It’s better to use [http://raa.ruby-lang.org/project/rjb/](http://raa.ruby-lang.org/project/rjb/) as a bridge if  
you need to use java whiting Ruby.

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 21, 2006, 9:10pm UTC](https://www.ruby-forum.com/t/rails-and-jruby/84881/3 "2006-03-21T21:10:21Z")

</div>

On 3/21/06, Wes G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Has anyone attempted to run Rails inside of JRuby?

Yes, it’s currently being worked on by the JRuby maintainers. Jump over  
to  
the JRuby lists at [http://sourceforge.net/mail/?group\_id=35413](http://sourceforge.net/mail/?group_id=35413) for  
details.  
See also recent posts at [http://headius.blogspot.com](http://headius.blogspot.com).

Is that even possible?

Not yet, but the plan is to have something to demo by JavaOne this year.

Aside from the performance implications, is it a bad idea?

I personally don’t think so – on the contrary, a solid implementation  
of  
Ruby on the JVM would do wonders for Ruby adoption across the huge  
installed  
base of Java and JVMs. For people accustomed to Java-based webapp  
deployments (like me), the idea of running Rails in a Java environment  
is  
staggering and liberating.

Cheers,  
/Nick

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 22, 2006, 5:13am UTC](https://www.ruby-forum.com/t/rails-and-jruby/84881/4 "2006-03-22T05:13:57Z")

</div>

Nick S. wrote:

> installed base of Java and JVMs. For people accustomed to Java-based  
> webapp deployments (like me), the idea of running Rails in a Java  
> environment is staggering and liberating.

Yeah, so I can have my servlet container… waaaaaa!

b

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 22, 2006, 2:58am UTC](https://www.ruby-forum.com/t/rails-and-jruby/84881/5 "2006-03-22T02:58:13Z")

</div>

Nick S. wrote:

> environment is staggering and liberating.  
> +1

Justin

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 30, 2006, 8:35am UTC](https://www.ruby-forum.com/t/rails-and-jruby/84881/6 "2006-03-30T08:35:01Z")

</div>

Thank you Nick for catching this…I need to start filtering to catch  
“JRuby” emails on the Rails list too 🙂

We are working feverishly right now to get Rails working on JRuby by  
mid-may, for our JavaOne presentation. I can give a brief status update  
here:

What works:

- script/generate runs, with all the base generators in 1.0. I have not  
done  
a comparison, but it appears to be generating correct code and  
configuration. Considering that generate loads up a substantial portion  
of  
Rails, we’re pretty happy that this runs successfully now.
- some other scripts in /script run, but we have not done a lot of  
additional testing

What doesn’t work:

- Actually handling a rails request (i.e. through dispatch.cgi) gets  
pretty  
far, but it’s still bombing out due to interpreter issues or missing  
functionality in JRuby. We believe that we’re pretty close, however.

How it will work:

We will probably create a “CGI Servlet” that primes JRuby’s environment  
such  
that Rails can run out-of-the-box. This should allow anyone to take a  
typical Rails app and a given Rails release, JAR them up in an  
appropriate  
way, and deploy them to your application server of choice. Our emphasis  
is  
to first make Rails run exactly as it does today, without requiring any  
unnecessary modification or special configuration (following the Rails  
mentality).

Eventually we would also like to provide seamless support for Rails to  
use  
J2EE services as though they were Rails equivalents. For example  
ActiveRecord adapters to JDBC, remote services in EJBs or Web Service  
mapped  
appropriately into the Rails world, JTA transaction management,  
clustering,  
failover, the ability to use JSPs for Rails presentation (such that  
existing  
apps with extensive existing UIs could be “half-ported” to Rails right  
away), and so on. Anything you do in J2EE could be mapped into its much  
more  
consumable Rails equivalent.

We’re very excited about the possibilities of JRuby on Rails, and we  
hope it  
will help make Rails a viable option for all those Java-only shops out  
there.

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 30, 2006, 8:00pm UTC](https://www.ruby-forum.com/t/rails-and-jruby/84881/7 "2006-03-30T20:00:11Z")

</div>

The “missing” features have ranged from bugs in the interpreter (for  
example, classes not being created with the correct nesting or scope) to  
Java’s inability (pre-1.5) to access environment variables (which makes  
running a JRuby on Rails “test CGI” impossible). We’re adding everything  
that’s missing right now, with a run, debug, fix cycle. Most of the  
recent  
issues have been minor things missing from JRuby’s core Ruby libraries,  
which are usually easy to add.

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 30, 2006, 9:26am UTC](https://www.ruby-forum.com/t/rails-and-jruby/84881/8 "2006-03-30T09:26:42Z")

</div>

Charles O Nutter wrote:

> What doesn’t work:
> 
> - Actually handling a rails request (i.e. through dispatch.cgi) gets pretty  
> far, but it’s still bombing out due to interpreter issues or missing  
> functionality in JRuby. We believe that we’re pretty close, however.

Interesting - what’s missing?

–  
David N. Welton

- [http://www.dedasys.com/davidw/](http://www.dedasys.com/davidw/)

Linux, Open Source Consulting

- [http://www.dedasys.com/](http://www.dedasys.com/)
