开发者

Java class definition in runtime [duplicate]

开发者 https://www.devze.com 2023-02-13 02:30 出处:网络
This question already has answers here: Closed开发者_如何学C 11 years ago. Possible Duplicate: How do I programmatically compile and instantiate a Java class?
This question already has answers here: Closed开发者_如何学C 11 years ago.

Possible Duplicate:

How do I programmatically compile and instantiate a Java class?

How to create a new java class at runtime?


Use Class<?> ClassLoader.defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain)

The problem is that this method is protected. So, you should extend class loader with your own class and call this method from there.

0

精彩评论

暂无评论...
验证码 换一张
取 消