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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -