Classpath search order is not respected by require when classpath includes both 
jars and directories
----------------------------------------------------------------------------------------------------

                 Key: JRUBY-2855
                 URL: http://jira.codehaus.org/browse/JRUBY-2855
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.1.3, JRuby 1.1.2
         Environment: Linux and WinXp.
            Reporter: Bill Dortch
            Assignee: Thomas E Enebo


Classpath search order is not respected by require when classpath includes both 
jars and directories.  A Ruby script defined in a directory later in the 
classpath will be loaded in preference to a script by the same name included in 
a jar earlier in the classpath.  For example:

Directory /var/tmp/foo contains file date.rb:
{noformat}
# /var/tmp/foo/date.rb
puts "foo date"
{noformat}

{noformat}
export CLASSPATH=/path/to/jruby/lib/jruby-complete.jar:/var/tmp/foo
java org.jruby.Main -e "require 'date'"
foo date
{noformat}

The JRubyClassLoader does find the correct file if I call it directly, so this 
must happen elsewhere in LoadService.  I took a quick look but didn't spot 
another place where classpath is searched.

The classpath search order _is_ respected if the files are included in a jar 
instead.

The use case is an environment that supports both JRuby and C-Ruby; ideally 
JRuby would load its own version of files included in jruby-complete.jar, but 
could share other directories with C-Ruby.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to