I've declared a Ruby method as:
require 'jruby/core_ext'
require 'java'
java_signature void test(java.util.HashMap)
def test(options={})
puts options[:name]
end
How can I call this method? Please let me know if I need to modify java_signature.
The easiest way is to implement an interface that your Java code expects, then pass an instance of that object to Java code. This assumes that JRuby will be the "main" of your program. If you need Java to be the "main" but still want to call Ruby code, you will need to look at the JRuby Embed (previously Red Bridge) API .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.