How to make the jvm load my java.lang.String instead of the one in rt.jar

ぃ、小莉子 提交于 2019-11-29 07:41:21
fge

You can do this using the -Xbootclasspath/p option at JVM startup:

-Xbootclasspath/p:/path/to/yourimpl.jar

/p stands for "prepend".

Note: -Xbootclasspath isn't a standard java option, so JVMs by different vendors may not support it.

Have a look at the java.lang.instrumentation API: you can implement a ClassFileTransformer which ignores the passed-in byte array and returns a bute array containing your own implementation of java.lang.String instead.

Better make sure that it's completely binary compatible with the original though or you will not get very far.

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