Running Java from Rails

Does anyone know of a possibility to run Java-Classes out of RoR (e.g.
use java objects in a ruby context)?

I’m a newbie regarding RoR coming from Java-Land and I’m asking myself
if there’s an easy way for me to code all the complex stuff in Java
and use it in RoR.

Thanx for your help!

Javier_CH wrote:

Does anyone know of a possibility to run Java-Classes out of RoR (e.g.
use java objects in a ruby context)?

I’m a newbie regarding RoR coming from Java-Land and I’m asking myself
if there’s an easy way for me to code all the complex stuff in Java
and use it in RoR.

Thanx for your help!

Coming from Java, let me tell you that coding the “complex stuff” in
ruby is much nicer than coding it in Java IMO. Take the time to learn
ruby and you will be extremely happy.

-Drew

I don’t know if there is such a way, but I think that you’d be losing
all the benefit of Ruby by doing the complex stuff (or anything, really)
in Java.

On 12 Feb., 17:47, Drew O. [email protected] wrote:

Coming from Java, let me tell you that coding the “complex stuff” in
ruby is much nicer than coding it in Java IMO. Take the time to learn
ruby and you will be extremely happy.

You’re right, but I think bytecode is probably faster then interpreted-
code when it comes to performance. What have your experiences been?

Second, we’ve a information retrieval project written in java (lucene)
which I’d like to use and I don’t think using it over a webservice is
an option…

Thanks for your replies.

On Feb 12, 2007, at 10:40 AM, Javier_CH wrote:

Does anyone know of a possibility to run Java-Classes out of RoR (e.g.
use java objects in a ruby context)?

I’m a newbie regarding RoR coming from Java-Land and I’m asking myself
if there’s an easy way for me to code all the complex stuff in Java
and use it in RoR.

I’m using RJB[1] to call a Java RMI client that talks to our backend
Java code. Working pretty well thus far. The maintainer is pretty
response too.

[1] http://rjb.rubyforge.org/

Thought I’d just weigh in here…

Javier_CH wrote:

On 12 Feb., 17:47, Drew O. [email protected] wrote:

Coming from Java, let me tell you that coding the “complex stuff” in
ruby is much nicer than coding it in Java IMO. Take the time to learn
ruby and you will be extremely happy.

You’re right, but I think bytecode is probably faster then interpreted-
code when it comes to performance. What have your experiences been?
Firstly, the chances are that it doesn’t matter - developer speed beats
cpu speed in general. Secondly, you’re probably right, but benchmark it

  • don’t guess.

Second, we’ve a information retrieval project written in java (lucene)
which I’d like to use and I don’t think using it over a webservice is
an option…
If you’re interested in Lucene but don’t need any of the Lucene-specific
tools, it’s really worth having a look at Ferret. It’s a Lucene-alike
written in C with Ruby bindings, and it’s very, very good.

Hope this helps :slight_smile:

Hi,

On 2/12/07, Javier_CH [email protected] wrote:

Does anyone know of a possibility to run Java-Classes out of RoR (e.g.
use java objects in a ruby context)?

Could this be something for JRuby?
http://jruby.codehaus.org

I’ve not done anything with it, but looking at the site it seems like it
may
be possible.
http://jruby.codehaus.org/Java+Integration

I’m a newbie regarding RoR coming from Java-Land and I’m asking myself

Or, optionally, Ruby can work with Solr, a Lucene based search service.

http://wiki.apache.org/solr/SolRuby

–Jeremy

On 2/12/07, Alex Y. [email protected] wrote:

Firstly, the chances are that it doesn’t matter - developer speed beats
Hope this helps :slight_smile:


Alex


http://www.jeremymcanally.com/

My free Ruby e-book:
http://www.humblelittlerubybook.com/book/

My blogs:

http://www.rubyinpractice.com/

On 2/12/07, Javier_CH [email protected] wrote:

On 12 Feb., 17:47, Drew O. [email protected] wrote:

Coming from Java, let me tell you that coding the “complex stuff” in
ruby is much nicer than coding it in Java IMO. Take the time to learn
ruby and you will be extremely happy.

You’re right, but I think bytecode is probably faster then interpreted-
code when it comes to performance. What have your experiences been?

This is premature optimisation. Which in engineering terms is a great
way to ruin a project. Its not like Rails insists that everything is
written in Rails/Ruby anyway.

A lot of the CPU intensive stuff, like funky graphics stuff is typically
handed over to binary stuff anyway.

Second, we’ve a information retrieval project written in java (lucene)
which I’d like to use and I don’t think using it over a webservice is
an option…

Well look at JRuby. It seems to be what you need, though it is a bit
early to consider running a full Rails install on it. It just about runs
Rails, which is probably a by-word for ‘but not in a mission critical
environment’.

The JRuby guys are pretty sharp though, and I don’t expect that
situation to stay that way for long.