Options for dynamic compilation in Java 5(Java 5 中的动态编译选项)
问题描述
除了 Janino 之外,还有其他选项可用于在 v5 中即时编译和执行 Java 代码吗?我知道 v6 有 Compiler API,但我需要使用 v5 VM.
我基本上需要获取一个包含完整 Java 类的字符串,对其进行编译并将其加载到内存中.
你想要的是 Janino.我们已经使用了多年.你给它(接近标准的)代码,它给你类,所以你可以使用它们.它实际上有很多不同的模式,并支持 1.5 语法糖和自动装箱等.
如果您调用 javac,您不仅需要为它所做的任何事情做好准备,您还必须处理将类放在正确的位置或制作额外的类加载器.
Janino 很容易.它应该正是您正在寻找的.p>
Are there any options other than Janino for on-the-fly compiliation and execution of Java code in v5? I know v6 has the Compiler API, but I need to work with the v5 VM.
I essentially need to take a string containing a complete Java class, compile it and load it into memory.
What you want is something like Janino. We've used it for years. You give it (near standard) code and it gives you the classes so you can use them. It actually has quite a few different modes and supports the 1.5 syntactic sugar and auto-boxing and such.
If you call javac, not only will you have to be ready for anything it does, you'll then have to handle putting the class in the right place or making an additional classloader.
Janino is very easy. It should be exactly what you are looking for.
这篇关于Java 5 中的动态编译选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Java 5 中的动态编译选项


- Jersey REST 客户端:发布多部分数据 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01