耙“没有这样的文件加载 - java”即使`哪个ruby` - > JRuby的

时间:2012-02-08 23:17:46

标签: rake jruby

我是Ruby noob(rube?),我在配置环境时无法让rake构建具有Java依赖性的东西。

我跑

$ PATH=/tmp/jruby-dodge:"$PATH" rake

并获取

/opt/local/bin/ruby -S rspec spec/contextual_spec.rb
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- java (LoadError)
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /Users/msamuel/work/igrigorik/contextual/lib/contextual/contextual.rb:1
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /Users/msamuel/work/igrigorik/contextual/lib/contextual.rb:2
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /Users/msamuel/work/igrigorik/contextual/spec/contextual_spec.rb:1
        from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load'
        from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
        from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
        from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
        from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
        from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
        from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
        from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `autorun'
        from /opt/local/bin/rspec:19
rake aborted!
/opt/local/bin/ruby -S rspec spec/contextual_spec.rb failed

Tasks: TOP => default => spec
(See full trace by running task with --trace)

PATH=/tmp/jruby-dodge:...确保which ruby实际解析为/opt/local/bin/jruby的符号链接。

是"没有这样的文件要加载 - java"与jruby有关吗? java -version发出java version "1.6.0_29"因此我认为无法启动JVM。

当使用rake构建具有Java依赖关系的东西以供在jruby下使用时,rake是否在jruby或ruby下运行是否重要?如果是这样,我该如何指定?

1 个答案:

答案 0 :(得分:3)

看起来rvm让我玩弄多颗红宝石。

Installing RVM解释了如何安装它。

rvm install jruby

确保rvm了解jruby。

rvm use jruby

更新环境,以便ruby表示jruby

宝石似乎是按照红宝石的味道安装的。