2013-04-09 35 views
0

今天,我給了JRuby一個嘗試與Apache的Mahout一起使用它。但是我對調試器有問題。當我把debugger陳述放在一個特定的地方時,它並不止於此。它在腳本末尾停止,然後當然沒有變量可用。這是我的Gemfile:JRuby調試器無法按預期工作

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/[email protected]/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/[email protected]/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

我安裝JRuby 1.7.3與RVM在我的OS X 10.8,並呼籲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 

也許安裝壞了,或者說我做某事錯。任何建議如何解決這個問題?

回答

1

我自己解決了它。經過努力了很久,我accidentially推杆之間的--debug聲明:

jruby --debug test.rb 

這很奇怪,但現在它按預期工作。