Xbooting a Java class [duplicate]

我与影子孤独终老i 提交于 2019-12-13 06:34:40

问题


Basically I want to replace the Canvas class at runtime by an application that uses my custom Canvas class, I heard xbooting can do this but there are no tutorials or anything.

So I'm just wondering what the vm arguments are, can you help me please?


回答1:


By xboooting you probably mean the -Xbootclasspath parameter?

You can use the -Xbootclasspath to override the classes that are being loaded when the VM is booting. This way you can give the VM your own implementation of a certain class and it will be used right from the start of the VM. You can do something like this:

java -Xbootclasspath/p:path_to_the_jar_with_myCanvas_class.jar HelloWorld.class

But the -Xbootclasspath won't replace the Canvas class at runtime, the replacement will occur already at the start of the VM.

Here is a nice post about Xbootclasspath : When to use -Xbootclasspath on HotSpot?



来源:https://stackoverflow.com/questions/14250363/xbooting-a-java-class

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