今天我尝试将JRuby用于Apache的Mahout。但我的调试器有问题。当我将debugger
语句放在特定的地方时,它并不止于此。它会在脚本结束时停止,然后当然没有变量可用。这是我的Gemfile:
source 'https://rubygems.org'
platform :jruby do
gem "jruby_mahout"
gem "ruby-debug"
end
这是剧本:
require 'rubygems'
require 'ruby-debug'
puts "I am called"
debugger
puts "I should not be called before the debugger"
但输出是:
I am called
/usr/local/rvm/gems/jruby-1.7.3@mahout/gems/ruby-debug-base-0.10.4-java/lib/ruby-debug-base.rb:215 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
I should not be called
/usr/local/rvm/gems/jruby-1.7.3@mahout/gems/ruby-debug-0.10.4/cli/ruby-debug/interface.rb:129
finalize if respond_to?(:finalize)
(rdb:1)
我想知道为什么会出现此警告tracing (e.g. set_trace_func) will not capture all events without --debug flag
,因为我使用jruby test.rb --debug
启动了脚本
我在OS X 10.8上安装了带有RVM的JRuby 1.7.3,并在调用jruby -version
时得到了这个输出:
jruby 1.7.3 (1.9.3p385) 2013-02-21 dac429b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_43-b01-447-11M4203 [darwin-x86_64]
NameError: undefined local variable or method `rsion' for main:Object
(root) at -e:1
也许装置坏了,或者我做错了。有任何建议如何解决这个问题?
答案 0 :(得分:1)
我自己解决了。经过长时间的尝试,我不小心在{}之间发布了--debug
语句:
jruby --debug test.rb
这很奇怪,但现在它按预期工作了。