There has been a history of "how to launch an application without a main method" questions, most stating something along the lines of "you can't". I noticed how JavaFX applications can now be launched simply by extending Application
. I've been using a method similar to Application.launch()
, but I've always seen the main method as boilerplate code in that situation. So I started looking for answers again.
I found this answer linking us to where we can learn about creating our own JVM launchers, but sadly the article no longer exists. I've spent quite a while looking for anything that might hint me on what I should do, but no results.
My Question
How would one create a custom JVM launcher to launch an application based on what is being extended? For example, imagine a project with 1 declared class:
class MyApplcation extends App {
}
No main method is needed for the project to be launched, since it extends App. This is not the question, although it is my target goal. The question is how could someone create a custom JVM launcher?
My guess is that it would involve using some kind of base, to give us a skeleton of some sort, but I'm not sure where to find such a thing.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…