使用Jruby而不是Ruby创建一个gem [英] Creating a gem using Jruby and not Ruby
问题描述
我也创建了一个独立的Ruby gem,安装它并成功使用它。
/ p>
我想用Jruby编写一个gem(而不是ruby)。当我尝试这样做,并安装了宝石后,它给了我以下错误:
`require':无法加载这样的文件 - java(LoadError)
是否有一种使用jruby编写gem的具体方法,不同于写宝石美国红宝石的方式?如果是这样,请直接给我一个有用的教程,帮助我使用jruby创建一个gem
谢谢。
编辑:
我将以下内容添加到jruby_gem.gemspec文件中
s.platform ='java'
使用命令:
gem build jruby_gem.gemspec
并使用以下命令安装它:
gem install jruby_gem-0.0.0
当我尝试使用以下命令运行它时:
irb
需要'jrubt_gem'
使用以下命令
jruby -S gem build jruby_gem.gemspecs
和
jruby -S gem install jruby_gem-0.0.0-java.gem
工作最后编辑给我。
So I was successful in writing a jruby file and reading from a jar file.
I also created a seperate Ruby gem, installed it and used it successfully.
I would like to write a gem using Jruby (and not ruby). When I did try to do so and after installing the gem, it gave me the following error:
`require': cannot load such file -- java (LoadError)
Is there a specific way to write a gem using jruby that is different from the way to write a gem usig ruby? If so, please direct me to a useful tutorial that helps me create a gem using jruby
thank you.
EDIT:
I added the following to the jruby_gem.gemspec file
s.platform = 'java'
Built the gem using the command:
gem build jruby_gem.gemspec
and installed it using the command:
gem install jruby_gem-0.0.0
And when I tried to run it using the commands:
irb
require 'jrubt_gem'
I still got the same error.
Using the following commands
jruby -S gem build jruby_gem.gemspecs
and
jruby -S gem install jruby_gem-0.0.0-java.gem
worked for me, finally.
这篇关于使用Jruby而不是Ruby创建一个gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!