如何将 JRuby 中的方法调用到我的 Java 代码中?

发布于 2024-11-27 04:43:24 字数 301 浏览 4 评论 0原文

现在我的 Ruby 脚本代码中有一个方法,基本上它返回一个变量,这个变量对我的 java 代码非常重要,所以我在 java 代码中想要的是调用 Ruby 脚本和脚本中的这个方法返回一个值,该值应分配给我拥有的变量..

这是我在ruby中的代码..我想在java中调用它并使用它返回的内容并将其放入变量中..

def numberMethod
  number = 3
return number
end

如果你知道我在哪里可以读到相关内容或者如果您知道如何解决,请给我评论或回答!

谢谢!

Now i have a method in my Ruby script code and basicaly its returning a variable and this variable is pretty important to my code in java, So what i whant in my java code is to call this method that is in the Ruby script and the script returns a value and this value shall be assigned to my variable that i have..

Here is the code i have in ruby.. And i whant to call it in java and use what it returns and put it in a variable ..

def numberMethod
  number = 3
return number
end

If you know where i can read about it or if you know how to solve it please give me a comment or answear!

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何以心动 2024-12-04 04:43:24

尝试阅读 RedBridge

try reading RedBridge

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文