2

我想使用 android-market-api jruby 版本。但是当我安装它并想要使用它时。

它会导致以下负载错误。

我使用https://github.com/jberkel/supermarket

java版本在这里:http ://code.google.com/p/android-market-api/

谁能帮我?

$ rvm use jruby

$ gem install supermarket
Fetching: json-1.5.0-java.gem (100%)
Fetching: json-jruby-1.5.0-java.gem (100%)
Fetching: supermarket-0.0.5-universal-java.gem (100%)
Successfully installed json-jruby-1.5.0-java
Successfully installed supermarket-0.0.5-universal-java
3 gems installed

$ irb

jruby-1.6.5 :001 > require 'supermarket'
LoadError: no such file to load -- supermarket
      from org/jruby/RubyKernel.java:1038:in `require'
      from (irb):1:in `evaluate'
      from org/jruby/RubyKernel.java:1088:in `eval'
      from /home/grant/.rvm/rubies/jruby-1.6.5/lib/ruby/1.8/irb.rb:158:in
`eval_input'
      from /home/grant/.rvm/rubies/jruby-1.6.5/lib/ruby/1.8/irb.rb:271:in
`signal_status'
      from /home/grant/.rvm/rubies/jruby-1.6.5/lib/ruby/1.8/irb.rb:155:in
`eval_input'
      from org/jruby/RubyKernel.java:1420:in `loop'
      from org/jruby/RubyKernel.java:1192:in `catch'
      from /home/grant/.rvm/rubies/jruby-1.6.5/lib/ruby/1.8/irb.rb:154:in
`eval_input'
      from /home/grant/.rvm/rubies/jruby-1.6.5/lib/ruby/1.8/irb.rb:71:in
`start'
      from org/jruby/RubyKernel.java:1192:in `catch'
      from /home/grant/.rvm/rubies/jruby-1.6.5/lib/ruby/1.8/irb.rb:70:in
`start'
      from /home/grant/.rvm/rubies/jruby-1.6.5/bin/irb:17:in `(root)' 
4

1 回答 1

3

第一的:

irb(main):003:0> require 'supermarket'
LoadError: no such file to load -- supermarket

但是之后:

irb(main):004:0> require 'rubygems'
=> true
irb(main):005:0> require 'supermarket'
=> true

您必须首先require让命令以 ruby​​gems 方式工作rubygemsrequire

更新正如@RobertRouse 在评论中指出的那样,您可以通过jirb--1.9模式下运行来实现相同的效果:

$ jruby --1.9 -S irb
irb(main):001:0> require 'supermarket'
=> true
于 2012-05-29T03:20:09.367 回答