Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何阻止RVM干扰JRuby_Java_Ruby_Rvm_Jruby_Warbler - Fatal编程技术网

Java 如何阻止RVM干扰JRuby

Java 如何阻止RVM干扰JRuby,java,ruby,rvm,jruby,warbler,Java,Ruby,Rvm,Jruby,Warbler,我已经使用Warbler从我的Ruby源代码创建了一个Jar文件。我还安装了RVM。jar的行为因RVM使用的Ruby版本而异:如果IRVM使用jruby则jar正常工作,但如果IRVM使用2.2则运行jar会将这些警告消息打印到控制台: Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2 Ignoring

我已经使用Warbler从我的Ruby源代码创建了一个Jar文件。我还安装了RVM。jar的行为因RVM使用的Ruby版本而异:如果I
RVM使用jruby
则jar正常工作,但如果I
RVM使用2.2
则运行jar会将这些警告消息打印到控制台:

Ignoring executable-hooks-1.3.2 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.2.7 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.2.7
如果我
rvm使用ruby-1.9.3-p484
,那么运行jar实际上会失败:

Ignoring unf_ext-0.0.7.1 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.1
Ignoring nokogiri-1.6.2.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.2.1
Ignoring nokogiri-1.6.6.2 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.6.2
Ignoring nokogiri-1.6.6.2 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.6.2
Ignoring executable-hooks-1.3.2 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.2.7 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.2.7
Ignoring nokogiri-1.6.2.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.2.1
Ignoring unf_ext-0.0.7.1 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.1
NameError: uninitialized constant Nokogiri::XERCES_VERSION
 const_missing at org/jruby/RubyModule.java:2733
       to_hash at /vagrant/myproject!/gems/nokogiri-1.6.6.2-java/lib/nokogiri/version.rb:73
       ...
如果我在没有安装rvm的计算机上运行jar,它可以正常工作


这是什么原因造成的,我如何阻止RVM干扰我的jar?

这不仅仅是RVM的错,系统Ruby安装可能也会干扰。。。取消设置
GEM_HOME
GEM_PATH
环境变量,使其不被使用

如果是.war,您还可以尝试使用
JRuby.runtime.ENV=false
system属性(或app-context-init参数)通过嵌入JRuby来完全隔离Ruby运行时,以空环境启动Ruby运行时


对于打包的.jar归档文件,请使用config.override\u gem\u home(也应与.war一起使用)

也许您应该尝试使用rbenv Unsetting gem\u PATH!它不是.war,所以我不能使用
jruby.runtime.env
。您知道是否有一些配置选项可以阻止jar尝试使用GEM_PATH环境变量吗?@fblundun是。。。使用
config.override\u gem\u home更新了答案