我有 Windows 7 Enterprise,我正在尝试运行 JRuby。我已经为 Ruby (1.9.3)、Java (jdk - 1.6.7) 和 JRuby (1.7preview) 设置了我的环境变量。我有一个网络驱动器,但我创建了一个似乎正在工作的 HOME 系统变量,因为我可以成功下载 Ruby 和 JRuby 的 gem,并将它们保存到我的本地驱动器。
当我尝试启动浏览器(即 firefox、chrome)时,它似乎为 JRuby 挂起,但不是 Ruby。这是JRuby在尝试执行 10 分钟后的跟踪:
irb(main):003:0> require 'rubygems'
=> false
irb(main):004:0> require 'watir-webdriver'
=> true
irb(main):005:0> b = Watir::Browser.new :ie
IRB::Abort: abort then interrupt! *<--Note I killed the process after 10 minutes*
from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
/shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common
/port_prober.rb:24:in `free?'
from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
/shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common
/port_prober.rb:5:in `above'
from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
/shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/ie/bridge.rb:17:in
`initialize'
from org/jruby/RubyHash.java:1429:in `delete'
from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
/shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/ie/bridge.rb:17:in
`initialize'
from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
/shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common/driver.rb:3
5:in `for'
from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
/shared/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver.rb:65:in `for'
from c:/Ruby/jruby-bin-1.7.0.preview1/jruby-1.7.0.preview1/lib/ruby/gems
/shared/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:35:in
`initialize'
from (irb):5:in `evaluate'
from org/jruby/RubyKernel.java:1037:in `eval'
from org/jruby/RubyKernel.java:1353:in `loop'
from org/jruby/RubyKernel.java:1146:in `catch'
from org/jruby/RubyKernel.java:1146:in `catch'
from c:\Ruby\jruby-bin-1.7.0.preview1\jruby-1.7.0.preview1\bin\irb:13:in
`(root)'
JRuby 似乎挂起,因为它正在寻找一个开放的端口。我们必须为我们的网络使用 HTTP 代理,我也为此设置了一个系统变量。我真的不知道为什么 Watir 会为 Ruby 而不是 JRuby 工作。