tags:

views:

433

answers:

2

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

+3  A: 

you can find quite a few examples about working with java classes at:
http://kenai.com/projects/jruby/pages/CallingJavaFromJRuby#Accessing_and_Importing_Java_Classes

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.

rubiii
+2  A: 

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 for java_import and java_import calls include_class.

Theo