Alex Rivera | Logout

JRuby: import vs include vs java_import vs include_class

Asked 2010-04-05T13:28:18.843
27

why so many different ways to include Java classes into JRuby? What are the differences? Which one should I use?

Edit
Report

1 Answer

24

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 of import due to the JRUBY-3171 bug.
Also include_class is or will be deprecated (JRUBY-3797) in favor of java_import.

Currently java_import is the recommended way to import a Java class.

answered 2010-04-05T13:57:21.207

Your Answer