简体   繁体   English

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

[英]How do i call methods from JRuby into my Java code?

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.. 现在我在Ruby脚本代码中有了一个方法,基本上它返回了一个变量,这个变量对我在Java中的代码非常重要,所以我想在我的Java代码中调用在Ruby脚本和脚本中的此方法返回一个值,并将此值分配给我拥有的变量。

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 .. 这是我在ruby中拥有的代码。我想在java中调用它,并使用它返回的内容并将其放在变量中..

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! 谢谢!

尝试阅读RedBridge

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

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