For those who might not be aware, rjb is a killer gem for using java
classes inside your rails app (or any ruby code). Check it out at: http://rubyforge.org/projects/rjb/
I was able to successfully use it in one of my apps that required some
code that is only available in java. And it’s much nicer than having to
compile a java app, then shell out using backticks, get back the return
value from the java app, split the strings, etc.
Last update to rjb was in this month, so the gem seems to be well
maintained by its author
Currently only one of my model uses rjb, so I put at the top of the file
outside the class declaration, but what if another model also needs rjb
access, and I put another Rjb::load, would it load the jvm twice? Should
I move it to a more common place like in an initializer?
While I’m at it, if you use textmate, can you run unit tests that use
rjb?
When I run the tests from console they pass, but from textmate,
interpreter tells me that the java method calls I make don’t exist, so I
guess rjb or jvm is not properly loaded.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.