title: JRuby on Rails: Adding a folder to the classpath
body: <p>I'm trying to add an entire folder to the JRuby 1.5 classpath for my Rails app. The <a href="http://kenai.com/projects/jruby/pages/FAQs#How_can_I_load_a_ResourceBundle_from_the_Rails_config_directory_?" rel="noreferrer">JRuby Wiki</a> suggests the following: "... add the config directory to the JRuby classpath in <code>config/environment.rb</code>:"</p>
  
  <pre><code>$CLASSPATH &lt;&lt; "file:///#{File.expand_path(File.join(RAILS_ROOT, 'config'))}/"
  </code></pre>
  
  <p>That doesn't seem to work for me. It doesn't matter whether I put that before, after or inside of the <code>Rails::Initializer.run</code> block. No matter what, I get:</p>
  
  <pre><code>/home/sean/src/sbruby/seo/config/environment.rb:45:NoMethodError: undefined method `&lt;&lt;' for nil:NilClass
  /home/sean/apps/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.7/lib/rails/backtrace_cleaner.rb:2:NameError: uninitialized constant ActiveSupport::BacktraceCleaner
  /home/sean/apps/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.7/lib/console_with_helpers.rb:5:NameError: uninitialized constant ApplicationController
  </code></pre>
  
  <p>For example, I'm trying to add a folder under <code>RAILS_ROOT</code> called <code>resources/foobar</code>, so I added the following to <code>environment.rb</code>:</p>
  
  <pre><code>$CLASSPATH &lt;&lt; "file:///#{File.expand_path(File.join(RAILS_ROOT, "resources", "foobar"))}/"
  </code></pre>
  
  <p>Same error.</p>
  
  <p>What is the right way to add a folder to the JRuby classpath with Rails?</p>