RFR 8004547: Extend JavaFX launcher support...
david.dehaven at oracle.com
Fri Dec 21 16:58:03 UTC 2012
>>>> Request for review for extending the launcher support to allow the JavaFX runtime to fully support all of it's launch features, including preloaders, classpath, etc..
>>>> >> >> Webrev:
>>>> >> http://cr.openjdk.java.net/~ddehaven/8004547/webrev.1/
>>> > > FXHelper.canLauncherFXAppJar launches a JAR with JavaFX-Application-Class. In the current version (before this fix), a FX JAR whose manifest can have a Main-Class entry that specifies the JavaFX application class that extends javafx.application.Application. Is that case no longer supported? Other than that, looks good.
>> Yes, it's handled. If there is no JavaFX-Application-Class and if the class defined by Main-Class extends Application then that will be detected later and launched using LM_CLASS instead of LM_JAR. Two of the tests specifically target this condition (lines 218 and 268).
> Later I figured out that too. In that case, I think loadJavaFxLauncher() is called twice. LM_CLASS may be used for a JAR file with a Main-Class pointing to a FX application entry point which is confusing. So the fxlauncher only needs to know the main class but not any other information in the JAR manifest?
I think you're confused as to what's happening..
In the absence of JavaFX-Application-Class, canLaunchFXAppJar simply returns false. It does not load the FX launcher on failure or it would be doing so for non-FX jars which would cause testExtraneousJars to fail. getMainClassFromJar then returns the class name defined by Main-Class. At that point it's processed no differently than any non-FX application jar, the main class is loaded and calls canLaunchFXAppClass where the doesExtendFXApplication check passes and *then* it loads the FX launcher and uses LM_CLASS to launch the application, not LM_JAR.
Essentially, launching an FX app via "java -jar fxapp.jar" is the same as "java -cp fxapp.jar SomeFXAppClass" if there is no JavaFX-Application-Class attribute.
As for naming of those methods… how about canLaunchAsFXAppClass and canLaunchAsFXAppJar (just added "As" in the middle). That should no longer imply it's an FX app class or jar but still convey what it's doing.
More information about the core-libs-dev