JRuby:导入vs包含vs java_import vs include_class [英] JRuby: import vs include vs java_import vs include_class
问题描述
为什么有这么多不同的方式将Java类包含到JRuby中?有什么区别?我应该使用哪一个?
why so many different ways to include Java classes into JRuby? What are the differences? Which one should I use?
推荐答案
您可以在以下位置找到很多有关使用Java类的示例:
https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby
You can find quite a few examples about working with Java classes at:
https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby
它指出,由于 JRUBY-,您应该使用java_import
而不是import
3171 错误.
另外,include_class
也已或将被弃用( JRUBY-3797 ),而推荐使用
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
.
目前,java_import
是导入Java类的推荐方法.
Currently java_import
is the recommended way to import a Java class.
这篇关于JRuby:导入vs包含vs java_import vs include_class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!