简体   繁体   English

如何在使用Warbler从Java构建的JAR中访问Ruby类?

[英]How do I access Ruby classes within a JAR built using Warbler from Java?

The method names in the compiled classes are weird and can not be used or called directly from Java. 编译类中的方法名称很奇怪,不能直接从Java中使用或调用。 And as there are dependencies among Ruby files with modules and libraries, I'm not able to invoke methods on those classes directly using ScriptingEngine. 由于Ruby文件与模块和库之间存在依赖关系,因此我无法使用ScriptingEngine直接在这些类上调用方法。 Any suggestion? 有什么建议吗?

This question gets to the root of the problem that you are experiencing with all of your other questions. 这个问题是您遇到的所有其他问题的根源。 JRuby and Warbler do not produce classes that you can just drop into a Java application. JRuby和Warbler 不会产生只能放入Java应用程序的类。 Ruby objects have a runtime library and all these other things that are needed. Ruby对象具有运行时库以及所有其他需要的东西 Ultimately, you need to start a Ruby runtime, and that's what the JRuby Embed API is all about. 最终,您需要启动Ruby运行时,这就是JRuby Embed API的全部目的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM