# File lib/rjbextension.rb, line 46
  def require(path)
    rjb_original_require(path)
  rescue LoadError
    # check that it's not a jar file

    raise unless path =~ /\.jar/

    # This will maybe use the wrong jar file from a previous version of the GEM

    # puts "LOAD PATH #{$LOAD_PATH}" 

    found_path = $LOAD_PATH.reverse.find{|p| File.exist?(File.join(p,path))}
    raise unless found_path

    abs_path = File.join(found_path, path)
    # check that the file exists

    raise unless  File.exist?(abs_path)

    # try to load it using RJB

    if Rjb::loaded?
      Rjb::add_jar abs_path
    else
      Rjb::add_classpath abs_path
    end
  end