从String中动态(内存中)编译和加载java类

1.Dynamic in-memory compilation

2.Generating Static Proxy Classes

3.java docs

4.Compile Java file (cannot run succ on my window xp with jdk 6)

在解决这个问题的步骤中,开始入手,我找到了不少相关的资料,最简单的方案是读取文件,调用javac,生成class,加载。过于简陋。

通过 reference 3 & 4,我的思路开始清晰,大体清楚了动态编译和加载的相关工具类组织结构

reference 1 & 2 给出的答案与我的思路相同。

R2 提到的 One easy solution is to make a ClassLoader that inherits from our current one. One of the risks is that we then enter ClassLoader hell.

还需要仔细体会。


其他相关链接:

http://www.google.com.hk/search?q=java+dynamic+compile+and+load&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:zh-CN:official&client=firefox-a
http://stackoverflow.com/questions/2946338/how-do-i-programmatically-compile-and-instantiate-a-java-class
http://www.dreamincode.net/forums/topic/119046-runtime-compile-and-loading-of-java-class-files/
http://www.csg.is.titech.ac.jp/~chiba/javassist/v1/tutorial.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值