我是jruby和irb的新手,我似乎有一个需要java的问题。以下是发生的事情:
irb(main):001:0> require 'java'
LoadError: cannot load such file -- java
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):1
from /usr/bin/irb:12:in `<main>'
irb(main):002:0>
在其他帖子中,我看到了在要求java之前需要rubygems的建议,但这似乎并不重要:
irb(main):003:0> require 'rubygems'
=> false
irb(main):004:0> require 'java'
LoadError: cannot load such file -- java
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):3
from /usr/bin/irb:12:in `<main>'
irb(main):005:0>
有人能指出我在正确的方向吗?
btw java IS安装:
/usr/local/jruby-1.7.9/samples/jrubyc_java$ java -version
java version "1.7.0_85"
OpenJDK Runtime Environment (IcedTea 2.6.1) (7u85-2.6.1-5ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.85-b03, mixed mode)
/usr/local/jruby-1.7.9/samples/jrubyc_java$
A
答案 0 :(得分:1)
您可能已在 /usr/local/jruby-1.7.9 安装了JRuby,但您的GEM_HOME
GEM_PATH
变量似乎指向已安装的系统(MRI)Ruby : /usr/lib/ruby/1.9.1/rubygems 尝试将irb
作为jruby -S irb
启动和/或取消设置这些变量(或者您可能需要将它们相应地设置为点到JRuby安装下的gem-home。