开发者

Limitations to modifying rt.jar

开发者 https://www.devze.com 2022-12-08 03:46 出处:网络
What are the limitations when modifying classes in rt.jar.I realize this is generally specific to the version and vendor of the JRE.I\'ve found that Hotspot in the Sun 1.6 VM, for instance, doesn\'t l

What are the limitations when modifying classes in rt.jar. I realize this is generally specific to the version and vendor of the JRE. I've found that Hotspot in the Sun 1.6 VM, for instance, doesn't like if you add fields to java.lang.Object as it has hard-coded assumptions about the size of Object. However, if I modify significant portions of the classes in rt.jar, I get spurious ClassNotFoundErrors at runtime for classes that are definitely in my jar. I've tried modifying rt.jar in place as well as superseding it with the various -Xbootclasspath parameters.

I don't really know where to look for documentation on this sort of thing, I can't find anyt开发者_如何学Pythonhing in the OpenJDK docs, for instance.


Have you considered using a byte code instrumentation library to achieve what you want? You could use ASM + java.lang.instrument, for JDK's greater than or equal to 5.0

0

精彩评论

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

关注公众号