简体   繁体   English

在Windows 7上安装Jruby时出错

[英]Error while installing jruby on windows 7

I am trying to install JRuby in my system, I follow the following steps: 我试图在系统中安装JRuby,请按照以下步骤操作:

  • Download a copy of the latest JRuby from the JRuby download page. 从JRuby下载页面下载最新的JRuby副本。
  • Unzip the file with your achive program. 用您的achive程序解压缩文件。 If you don't have one that works, download 7-Zip. 如果没有有效的方法,请下载7-Zip。
  • Copy the JRuby folder called jruby-1.7.2 directly to "C:/" 将名为jruby-1.7.2的JRuby文件夹直接复制到“ C:/”
  • Set environment variables on your system. 在系统上设置环境变量。 Right click "My Computer" go to "Advanced" then "Environmental Variables". 右键单击“我的电脑”,然后依次转到“高级”和“环境变量”。 Create these: JRUBY_HOME = C:/jruby-1.7.2 创建这些: JRUBY_HOME = C:/jruby-1.7.2
  • Next you'll have to edit the PATH variable. 接下来,您必须编辑PATH变量。 Add ;C:\\jruby-1.1.5\\bin; 添加;C:\\jruby-1.1.5\\bin; to the end of that variable. 到该变量的末尾。

And then I am running the command: 然后我运行命令:

C:\Users\sitanshu\rubyApp\jruby-1.7.2>jruby -v

then it shows the following error: 然后显示以下错误:

jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) Client VM 1.7.0-ea-b19 [Windows Vista-x86]
NameError: uninitialized constant Java::JavaLang::ProcessBuilder::Redirect
   const_missing at org/jruby/RubyModule.java:2677
  ProcessManager at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel/jruby/process_manager.rb:12
           JRuby at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel/jruby/process_manager.rb:6
          (root) at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel/jruby/process_manager.rb:3
            load at org/jruby/RubyKernel.java:1046
          (root) at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel.rb:1

So where am I going wrong and what is the solution for that? 那么,我哪里出问题了,那该怎么办呢?

我将测试Java是否已更新并正常工作

java -version

Under your environment variables, make sure you have a JAVA_HOME variable pointing to your JRE root folder, like this: 在环境变量下,确保您有一个指向JRE根文件夹的JAVA_HOME变量,如下所示:

  • C:\\Program Files\\Java\\jre7\\

Make sure your Java JRE bin folder is also part of your PATH variable: 确保您的Java JRE bin文件夹也是PATH变量的一部分:

  • ;C:\\Program Files\\Java\\jre7\\bin\\

Additionally, when you are adding jruby to your PATH variable, make sure you are referencing the correct folder location. 此外,在将jruby添加到PATH变量时,请确保引用的文件夹位置正确。 In the example you have given, you are installing jruby to C:\\jruby-1.7.2 , but then you are actually referring to this different folder C:\\jruby-1.1.5 in your PATH configuration. 在您给出的示例中,您正在将jruby安装到C:\\jruby-1.7.2 ,但是实际上您是在PATH配置中引用了这个不同的文件夹C:\\jruby-1.1.5

Also, when you are defining your JRUBY_HOME variable, make sure you are using backslash \\ characters. 另外,在定义JRUBY_HOME变量时,请确保使用反斜杠\\字符。 In your example above you used a forward slash / character. 在上面的示例中,您使用了正斜杠/字符。 Remember, that windows uses backslashes between folders. 请记住,Windows在文件夹之间使用反斜杠。

Finally, after you've made all your environment variable changes, remember to open a new command window for your changes to take effect. 最后,在完成所有环境变量的更改后,请记住打开新的命令窗口以使更改生效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM