Xbooting a Java class [duplicate]
Asked Answered
F

1

0

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?

Flatus answered 10/1, 2013 at 3:25 Comment(5)
"uses my custom Canvas class" DYM a java.awt.Canvas? Time to join us in the 3rd millennium & use Swing. BTW 1) What is the use-case here for a) Extending this class. b) Using it instead of the inbuilt class? 2) It will not be legal to distribute this app. AFAIU.Dulcle
@AndrewThompson - My understanding is that it would not be legal to distribute a JVM that had the custom class instead of the standard one. However, distributing the class together instructions on how to modify the bootclasspath would be OK. (Doesn't make it a good idea though ...)Bolus
@StephenC Thanks for clarifying. Your suggestion makes more sense.Dulcle
BTW -1 for ignoring my questions. They were intended to help you arrive at the best solution.Dulcle
@AndrewThompson I think that Francis should have answered your questions although I do not think they are relevant to the original problem and thus the downvote is not deserved. The problem is simple - how to setup a bootclasspath, that does not need to be justified by a usecase. Plus, as StephenC already pointed out, its perfectly legal to write/distribute such apps. Thank you.Albion
C
3

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?

Carlocarload answered 10/1, 2013 at 4:30 Comment(1)
Yea thats what i want haha :) just trying to figure out the rest of the parametersFlatus

© 2022 - 2024 — McMap. All rights reserved.