why so many different ways to include Java classes into JRuby? What are the differences? Which one should I use?
相关问题
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
- ruby 1.9 wrong file encoding on windows
- gem cleanup shows error: Unable to uninstall bundl
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- How to detect if an element exists in Watir
- uninitialized constant Mysql2::Client::SECURE_CONN
- ruby - simplify string multiply concatenation
You can find quite a few examples about working with Java classes at:
https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby
It states, that you should use
java_import
instead ofimport
due to the JRUBY-3171 bug.Also
include_class
is or will be deprecated (JRUBY-3797) in favor ofjava_import
.Currently
java_import
is the recommended way to import a Java class.import
doesn't play well with Rake, so it's discouraged.java_import
is the newest, and recommended.include_class
has been deprecated. Apart from that they all do the same thing, and are actually aliases of each other.import
is an alias forjava_import
andjava_import
callsinclude_class
.