[Rubygems-developers] Ability to require jar-files

Ola Bini ola.bini at ki.se
Tue Oct 3 01:08:50 EDT 2006


Michael Studman wrote:
>> JRuby-specific extensions to RubyGems. One small feature that would be 
>> very welcome for us would be to make it possible to require jar-files in 
>> the regular load-path. We have added support for JRuby such that executing
>> require 'bin_ext'
>> will search for bin_ext.rb and bin_ext.jar on the load path. If the same 
>> would be possible with gems, it would mean we can package extensions and 
>> people can use them the same way .so-extensions are used.
>>   
> I think this is all already working. I'm nearly done porting the 
> .so-extension of a certain Ruby gem to a Java  extension and I can get 
> JRuby & Gem loading my jar just fine through "require 'bin_ext'" (which 
> finds the jar at 
> "$JRUBY_HOME/lib/ruby/gems/1.8/gems/my_gem_name-v.e.r-java/lib/bin_ext.jar"). 
> I can also confirm that require_gem with a version requirement loads the 
> right jar too!
> 
> It was a pleasant surprise that this all just worked for me. I had to 
> check multiple times to ensure I hadn't inadvertently sprinkled some 
> Java classpath pixy dust which made it all work when it shouldn't have.
> 
> The only problem I had when creating this JRuby-specific variant of the 
> Gem was that there was no Gem::Platform::Java or Gem::Platform::JRuby to 
> use for the spec's platform (I'm just using "java" in the mean time).
> 
> If I've misunderstood what you're actually asking here, Ola, then sorry 
> for the line noise.
> 
> Michael.
> 

Michael,

It doesn't work for me, at least.

-- 
  Ola Bini (http://ola-bini.blogspot.com)
  JvYAML, RbYAML, JRuby and Jatha contributor
  System Developer, Karolinska Institutet (http://www.ki.se)
  OLogix Consulting (http://www.ologix.com)

  "Yields falsehood when quined" yields falsehood when quined.



More information about the Rubygems-developers mailing list