我已经安装了jRuby。我不知道问题是什么。我在OSX上用rbenv安装了jRuby。
echo $ JAVA_HOME没有输出
❯ rbenv versions
system
1.9.3-p125
* 2.2.3 (set by /usr/local/var/rbenv/version)
jruby-9.0.5.0
~
❯ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
~
❯ rbenv shell jruby-9.0.5.0
~
❯ rbenv version
jruby-9.0.5.0 (set by RBENV_VERSION environment variable)
~
❯ ruby -v
jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64]
~
❯ jirb
irb(main):001:0> require 'java'
=> false
irb(main):002:0>
答案 0 :(得分:1)
您正在使用JRuby require 'java'
会在MRI上引发错误
ruby -v
输出确认找到了JVM(不需要JAVA_HOME
)