1.Dynamic in-memory compilation
2.Generating Static Proxy Classes
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