问题
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