Using Java resources in JRuby

Hi,

I was wondering whether some of you could comment or give me some
insights
about how exactly the JRuby runtime is dealing with the Java resources
that
a particular JRuby script needs and uses.

Imagine, that i have a JRuby script, which depends on a particular Java
library, packed as a jar archive. Usually, i will put a ‘require’
statement
in the beginning of the script, giving the path to the jar file on the
file
system. Thus, the JRuby script declares its dependency on some Java
resources. Then, i can use classes from the library in my JRuby code.

But what would happen if i comment the ‘require’ statement ? Will the
JRuby
interpreter signal an error when it reaches the first line of the
script,
which actually makes use of the library ?

The very natural answer is ‘yes, it will yield an error’.

However, i have managed to get a particular JRuby set up running, in
which:
i have commented my ‘require’ statement, moved the jar file to some very
different location, and i have made the jar visible to the class loader
of
my application. And it works ! And since i am sure that my JRuby script
actually needs the jar, this means that somehow the JRuby runtime ‘sees’
my
jar file and finds it.

I know that when JRuby needs some resource, it searches some specific
file
system locations (and also searches the paths defined by ‘require’
statements), but is there anything else that it also does ? How can be
my
set up explained - why has the jar been found ?

Kindest Regards,
Krum.

View this message in context:
http://old.nabble.com/Using-Java-resources-in-JRuby-tp28678739p28678739.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email