Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Not A Bug
-
Affects Version/s: JRuby 1.6.5, JRuby 1.7.0.pre1
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: Embedding
-
Labels:None
-
Environment:OS X 10.7.2
jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
-
Testcase included:yes
-
Number of attachments :
Description
See the following jirb session:
macbeth:ruboto-core uwe$ jirb >> require 'java' => true >> s = org.jruby.embed.ScriptingContainer.new(org.jruby.embed.LocalContextScope::SINGLETON) => #<Java::OrgJrubyEmbed::ScriptingContainer:0x4280bc28> >> s.load_paths.add '/tmp' => true >> s.runScriptlet 'p $:' ["/Library/Frameworks/JRuby.framework/Gems/1.8/gems/wirble-0.1.3/lib", "/Library/Frameworks/JRuby.framework/Versions/1.6.5/lib/ruby/site_ruby/1.8", "/Library/Frameworks/JRuby.framework/Versions/1.6.5/lib/ruby/site_ruby/shared", "/Library/Frameworks/JRuby.framework/Versions/1.6.5/lib/ruby/1.8", "."] => nil
However when using LocalContextScope.SINGLETHREAD the path is added:
macbeth:ruboto-core uwe$ jirb >> require 'java' => true >> s = org.jruby.embed.ScriptingContainer.new(org.jruby.embed.LocalContextScope::SINGLETHREAD) => #<Java::OrgJrubyEmbed::ScriptingContainer:0x441743be> >> s.load_paths.add '/tmp' => true >> s.runScriptlet 'p $:' ["/tmp", "/Library/Frameworks/JRuby.framework/Versions/1.6.5/lib/ruby/site_ruby/1.8", "/Library/Frameworks/JRuby.framework/Versions/1.6.5/lib/ruby/site_ruby/shared", "/Library/Frameworks/JRuby.framework/Versions/1.6.5/lib/ruby/1.8", "."] => nil
Shouldn't the extra load path be added for SINGLETON as well?
I see the problem. I'll look in to it.
Let me add the reason of this bug. In this case, jirb creates Ruby runtime and ScriptingContainer uses that runtime. So, if you set a load_path not on jirb (in a Java code), probably, this doesn't happen.