Overriding single classes from rt.jar

好久不见. 提交于 2019-11-30 22:53:38

You can use the VM parameter -Xbootclasspath/p to prepend your own JAR file with the patched class to the boot class path.

I believe the only supported way of doing this is to "patch" rt.jar by replacing the desired *.class file. 7-Zip can help you easily do this.

This is exactly how Oracle supplied their double-parsing bug fix with their FPUpdater tool, which was essentially a script that did just this. (Some history.)

I think you can try to use javaagent You must intercept event, when JVM loads system class and swap it to yours

I think @ziesemer is correct, but you may be able to use the classloader to replace the offending class when your app is bootstrapping. This may be cleaner if you don't want to worry about the JDK updating underneath you, though you'd have to stick this bootstrapping classloader code into every app you are working on.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!