[rjb-users] Can't find jarfile classes with Rails

rjb-users at rubyforge.org rjb-users at rubyforge.org
Sat Nov 18 15:50:29 EST 2006


I am having problems with RJB importing a class from a
jarfile when using Rails.

The following works fine (on Linux amd64):

(1) Create a directory called 'test', and copy a
jarfile into it (I'm using Junit 'junit-3.8.1.jar',
but any jarfile will do).

(2) export CLASSPATH="./junit-3.8.1.jar"

(3) $ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require_gem 'rjb'
=> true
irb(main):003:0> require 'rjb'
=> true
irb(main):004:0> Rjb::import 'junit.framework.Assert'
=> #<Rjb::Junit_framework_Assert:0x2b1e487c2360>

So far so good.

But loading Rails first and then the JUnit class
fails:

$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require_gem 'rails'
=> true
irb(main):003:0> require_gem 'rjb'
=> true
irb(main):004:0> require 'rjb'
=> true
irb(main):005:0> Rjb::import 'junit.framework.Assert'
InternalError: unknown exception
        from (irb):5:in `import'
        from (irb):5
irb(main):006:0> Rjb::import 'junit.framework.Assert'
NoClassDefFoundError: junit/framework/Assert
        from (irb):6:in `import'
        from (irb):6
        from :0

Notice how I'm getting two different errors for the
same invocation of Rjb::import.

Does anyone else have the same probelem?

thanks,
Rich




____________________________
Richard Apodaca
Blog: http://depth-first.com


 
____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. 
$310k for $999/mo. Calculate new payment! 
www.LowerMyBills.com/lre


More information about the rjb-users mailing list