我如何动态调用Java代码? [英] How could I call Java code dynamically?
本文介绍了我如何动态调用Java代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要实现的Java代码将如下所示: / p>
System.execute(String str = \test\; System.out.println(str););
这将打印单词'test'。 (10x dehmann)
代码示例可以帮助很多。
解决方案
p>查看BeanShell或Groovy。两者都会给你合理的解决方案 - 但这些解决方案依赖于我对你的问题的解释,这可能是有缺陷的。
How could I write Java code that is executed like javascript code used together with the eval function?
What I would like to achieve would be something like this:
System.execute ("String str = \"test\"; System.out.println(str);");
which would print the word 'test'. (10x dehmann )
A code sample would help a lot.
解决方案
Look into BeanShell or Groovy. Both will give you reasonable solutions--but those solutions rely on my interpretation of your problem, which may be flawed.
这篇关于我如何动态调用Java代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文