我有一个应用程序,可以获取html文件的内容.
让我们说页面的文字是:
String[] arr = new String[] {"!","@","#"};
for (String str : arr) {
write(str);
}
我可以以某种方式编译此文本并在我的应用程序中运行代码吗?
谢谢
解决方法:
使用Janino.它是一个java运行时内存编译器.比BCEL和喜欢的方式更容易.
从主页:
“Janino是什么?
Janino is a super-small, super-fast Java™ compiler. Not only can it compile a set of source files to a set of class files like the JAVAC tool, but also can it compile a Java™ expression, block, class body or source file in memory, load the bytecode and execute it directly in the same JVM. Janino is not intended to be a development tool, but an embedded compiler for run-time compilation purposes…