开发者

Java: defineClass and inner classes

In my own classloader I get all entries from jar file and use defineClass() to load classes to memory.

My 开发者_StackOverflow中文版problem is that if jar has inner classes (e.g. MyClass$1.class) the defineClass method fails with java.lang.NoClassDefFoundError: IllegalName exception.

Obviously java needs all files from jar to make it work but how the inner classes can be loaded?


MyClass$1.class should match an anonymous inner class. If your inner class is named, it should be MyClass$InnerClass.class

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜