[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

jirb: require java => false ????

PB0711

3/24/2008 5:40:00 PM

Hello all,

Ok I'm new to the ruby world and a complete newbie in jruby/java so
I'm probably being dump but what is wrong here? Why isn't require
'java' working and 2nd (probably be fixed I guess when require java
works) why is require_gem an undefined method??

Cheers,

Paul

Code:
/local/Ruby> echo $JAVA_HOME
/local/jdk1.6.0_05
:/local/Ruby> echo $JRUBY_HOME
/local/Ruby/Jruby/jruby-1.1RC3/

:/local/Ruby> jirb --version
irb 0.9.5(05/04/13)
irb(main):001:0> require 'java'
=> false
irb(main):002:0> include Java
=> Object
require 'rubygems'
=> true

require_gem 'ActiveRecord-JDBC'
NoMethodError: undefined method `require_gem' for main:Object
from (irb):7:in `signal_status'
3 Answers

Ben Bleything

3/24/2008 5:42:00 PM

0

On Tue, Mar 25, 2008, PB0711 wrote:
> Ok I'm new to the ruby world and a complete newbie in jruby/java so
> I'm probably being dump but what is wrong here? Why isn't require
> 'java' working and 2nd (probably be fixed I guess when require java
> works) why is require_gem an undefined method??

#require returns false when the file has already been loaded. This
means that java has already been required before you tell it to do so.

If it had really failed it would have raised an exception.

I can't shed any light on the other problem, though :)

Ben

Nick Sieger

3/24/2008 5:50:00 PM

0

On Mon, Mar 24, 2008 at 12:39 PM, PB0711 <hpbenton@gmail.com> wrote:
> Hello all,
>
> Ok I'm new to the ruby world and a complete newbie in jruby/java so
> I'm probably being dump but what is wrong here? Why isn't require
> 'java' working and 2nd (probably be fixed I guess when require java
> works) why is require_gem an undefined method??
>
> Cheers,
>
> Paul
>
> Code:
> /local/Ruby> echo $JAVA_HOME
> /local/jdk1.6.0_05
> :/local/Ruby> echo $JRUBY_HOME
> /local/Ruby/Jruby/jruby-1.1RC3/
>
> :/local/Ruby> jirb --version
> irb 0.9.5(05/04/13)
> irb(main):001:0> require 'java'
> => false
> irb(main):002:0> include Java
> => Object
> require 'rubygems'
> => true
>
> require_gem 'ActiveRecord-JDBC'
> NoMethodError: undefined method `require_gem' for main:Object
> from (irb):7:in `signal_status'

"require_gem" is an obsolete method in Rubygems, the new one is just
"gem". Also, since you're using RC3, you probably want to use
activerecord-jdbc-adapter 0.8 instead...

/Nick

PB0711

3/26/2008 5:20:00 AM

0


Nick and Ben thank you for the help :D