java内存编译 [英] java in-memory compilation

查看:131
本文介绍了java内存编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在运行时从字符串生成字节码(Byte []),而不使用javac过程或这种类型的东西?有没有一种简单的方法来调用这样的编译器?

How can i generate bytecode (Byte[]) from a String at runtime, without using a "javac" process or something of this sort? is there a simple way of calling the compiler like that?

后加:

href =http://stackoverflow.com/questions/200833/when-should-i-accept-an-answer>接受最符合情况的解决方案。我的应用程序是一个爱好项目仍在设计草图阶段,这是正确的时间来考虑插入新技术。另外,因为本应该帮助我的人是一个JavaScript开发人员,使用JavaScript解释器而不是存根编译器+ classLoader的想法似乎在这种情况下对我更有吸引力。这个问题的其他(不接受的)答案是信息性的,并且据我所知,回答我的问题很好,所以感谢,但我要尝试 Rhino :)

I chose to accept the solution that actually best fits my situation. my application is a hobby-project still in design sketch phase, and it is the right time to consider inserting new technology. also, since the guy that's supposed to help me with BL is a JavaScript developer, the idea of using a JavaScript interpreter instead of a stub compiler+classLoader seems more appealing to me in this situation. other (unaccepted) answers of this question are informative and, as far as i can tell, answer my question very well, so thanks, but I'm going to try Rhino :)

推荐答案

您可能会找到像rhino或groovy在实践中更有用。

You might find something like rhino or groovy more useful in practice.

这篇关于java内存编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆