How to invoke a java static method from jruby -
how do this?
include java thread.currentthread.sleep 3
i saw posting several years ago did not directly answer question.
thx
either:
java::javalang::thread::sleep 3
or
java::javalang::thread.sleep 3
(note static call sleep() on thread causes current thread sleep, no need call currentthread()
, , sleep time in millisecond).
here example (if use jruby prior 1.7, need add require 'java'
):
t = java::javalang::thread.new puts "hi." java::javalang::thread::sleep 3000 puts "done." end t.start
Comments
Post a Comment