JRuby:导入vs包含vs java_import vs include_class [英] JRuby: import vs include vs java_import vs include_class

查看:72
本文介绍了JRuby:导入vs包含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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆