JRoR: Auto-loading of JDBC drivers via RAILS_ROOT/lib

All,

Just to verify…

If I place the required JDBC drivers for my application in
RAILS_ROOT/lib, will they automatically be placed in the CLASSPATH for
the JRuby runtime when I start my Rails app.?

If so, what line of code actually causes that to happen?

I have some JARs that are deployed as part of a Rails plugin (so they
aren’t in RAILS_ROOT/lib, they are in
RAILS_ROOT/vendor/plugins/blah/lib, and I would like to simulate this
autoloading that I understand happens in JRoR.

If I’m mistaken about the ability to autoload JDBC drivers by placing
them in RAILS_ROOT/lib, obviously, I need to know about that.

Many thanks,
Wes

Some updates:

  1. JAR files placed in RAILS_ROOT/lib will not be auto-require’d into
    the Rails application.

  2. JAR files placed in JRUBY_HOME/lib will be added to the runtime
    CLASSPATH and available to the Rails app.

Wes

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs