Skip to content

Gems in a jar can't be required from code #1812

Closed
@blerins

Description

@blerins

Hi!

I'm using gems-in-a-jar (http://blog.nicksieger.com/articles/2009/01/10/jruby-1-1-6-gems-in-a-jar/) for packaging an application, but I'm having trouble with it, I can't require the jar from within code:

$ jar tf andlib.jar 
META-INF/
META-INF/MANIFEST.MF
gems/
gems/andand-1.3.3/
gems/andand-1.3.3/test/
gems/andand-1.3.3/test/test_helper.rb
gems/andand-1.3.3/test/andand_spec.rb
gems/andand-1.3.3/License.txt
gems/andand-1.3.3/lib/
gems/andand-1.3.3/lib/andand/
gems/andand-1.3.3/lib/andand/version.rb
gems/andand-1.3.3/lib/andand.rb
gems/andand-1.3.3/History.txt
gems/andand-1.3.3/README.textile
build_info/
cache/
cache/andand-1.3.3.gem
doc/
specifications/
specifications/andand-1.3.3.gemspec

$ java -jar jruby-complete.jar -v
jruby 1.7.13 (1.9.3p392) 2014-06-24 43f133c on OpenJDK 64-Bit Server VM 1.7.0_55-b14 [linux-amd64]

$ java -jar jruby-complete.jar -I . -randlib.jar -S irb
irb(main):001:0> require 'andand'
=> true
irb(main):002:0> exit

$ java -jar jruby-complete.jar -I . -S irb
irb(main):001:0> require 'andlib.jar'
=> true
irb(main):002:0> require 'andand'
LoadError: no such file to load -- andand
    from org/jruby/RubyKernel.java:1065:in `require'
    from file:/home/bruno/javajars/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
    from (irb):2:in `evaluate'
    from org/jruby/RubyKernel.java:1101:in `eval'
    from org/jruby/RubyKernel.java:1501:in `loop'
    from org/jruby/RubyKernel.java:1264:in `catch'
    from org/jruby/RubyKernel.java:1264:in `catch'
    from file:/home/bruno/javajars/jruby-complete.jar!/META-INF/jruby.home/bin/jirb:13:in `(root)'
    from org/jruby/RubyKernel.java:1081:in `load'
    from file:/home/bruno/javajars/jruby-complete.jar!/jruby/commands.rb:1:in `(root)'
    from jirb:1:in `(root)'
irb(main):003:0> exit

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions