jruby-complete没有运行耙子或其他下载的宝石

时间:2015-07-10 22:09:50

标签: java ruby windows jruby

在以下网址中输入指南:

http://spin.atomicobject.com/2010/02/01/running-a-ruby-application-with-jruby-complete/

我下载了jruby-complete,并且能够运行一个或两个基本的简单命令。但是,我想跑Rake。当我发布java -jar jruby-complete.jar -S rake -T时,我的Windows机器上遇到了这些错误。

λ run_jruby.bat -S rake -T
io/console not supported; tty will not be manipulated
LoadError: no such file to load -- file:C:/Users/user01/Desktop/jruby_ant_tasks/jruby-complete-1.7.21.jar!/META-INF/jruby.home/lib/ruby/gems/shared/specifications/gems/rake-10.1.0/bin/rake
    load at org/jruby/RubyKernel.java:1059
  (root) at /C:/Users/user01/Desktop/jruby_ant_tasks/jruby-complete-1.7.21.jar!/META-INF/jruby.home/bin/rake:23

然后按照此URL获取更多指导:

http://spin.atomicobject.com/2013/04/24/bundler-jruby-complete/

我创建了一个vendor\gem_home目录。然后使用以下命令安装bundler和rake:

λ run_jruby.bat -S gem install -i vendor\gem_home\ --no-rdoc --no-ri bundler rake
io/console not supported; tty will not be manipulated
Fetching: bundler-1.10.5.gem (100%)
Successfully installed bundler-1.10.5
Fetching: rake-10.4.2.gem (100%)
Successfully installed rake-10.4.2
2 gems installed

但是,当我做一个宝石列表

时,没有列出Bundler
λ run_jruby.bat -S gem list --local
io/console not supported; tty will not be manipulated

*** LOCAL GEMS ***

jar-dependencies (0.1.15)
jruby-openssl (0.9.7 java)
json (1.8.0 java)
rake (10.1.0)
rdoc (4.1.2)

然后我再次运行rake命令,并得到与上面相同的错误。当我运行bundle命令时,我收到以下错误:

λ run_jruby.bat -S bundle gem new_gem
ArgumentProcessor.java:565:in `resolveScript': java.lang.NullPointerException
        from ArgumentProcessor.java:523:in `runBinScript'
        from ArgumentProcessor.java:277:in `processArgument'
        from ArgumentProcessor.java:100:in `processArguments'
        from ArgumentProcessor.java:95:in `processArguments'
        from RubyInstanceConfig.java:196:in `processArguments'
        from Main.java:216:in `run'
        from Main.java:197:in `main'

以下是有关我的系统的更多信息。我的Java版本是:

λ java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

我的JRuby版本是:

λ run_jruby.bat -v
jruby 1.7.21 (1.9.3p551) 2015-07-07 a741a82 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_71-b14 +jit [Windows 7-amd64]

我的run_jruby.bat文件包含:

λ cat run_jruby.bat
@echo off

SET JAVA_COMMAND="java"
SET JAVA_OPTIONS="-jar"
SET JRUBY_BIN="jruby-complete-1.7.21.jar"
SET GEM_HOME="vendor\gem_home"
SET GEM_PATH="vendor\gem_home"

%JAVA_COMMAND% %JAVA_OPTIONS% %JRUBY_BIN% %*

我不确定我还需要做什么,因为Wiki没有太多报道这部分内容。

- 2015-07-13编辑 -
刚刚在RHEL 5.8中使用IBM Java 1.6尝试了相同的设置,并且Rake命令工作正常,因此它似乎是Windows特定的问题。

1 个答案:

答案 0 :(得分:0)

这似乎是JRuby在1.7.21版本时的错误。

https://github.com/jruby/jruby/issues/3133

JRuby二进制文件未检查未初始化的环境PATH变量。该问题已在JRuby的1.7.22中修复。