RFR 8004547: Extend JavaFX launcher support...
david.dehaven at oracle.com
Sat Dec 22 00:57:37 UTC 2012
> I need more coffee this morning :-)
I have that problem often :)
>> 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.
> This explains what caused the confusion - I didn't expect that "java -jar fxapp.jar" will be passed to fxlauncher with the same launch mode as "java -cp fxapp.jar SomeFXAppClass" (i.e. LM_CLASS). I think the semantics there was not obvious why it is not LM_JAR mode but JAVAFX_LAUNCH_MODE_xxx has a different semantics than LM_JAR and LM_CLASS that are defined in java.c and also LauncherHelper. Is there any reason why "java -cp fxapp.jar" can't be passed to fxlauncher with LM_JAR mode? That'll be consistent how launch mode is used in java.c and the non-FX app. I'll leave it for you and Kumar/Kevin to decide if this is important to address.
I *think* what you're asking is why can't we always use "LM_JAR" if java was launched with "java -jar fxapp.jar", correct? Even if there are no JavaFX-* attributes in the manifest.
I don't entirely disagree with the idea… it would require some adjustments to this patch and I'd have to file an issue against FX to have it fall back on Main-Class when it encounters a jar with no JavaFX-* attributes and at least two of the tests would have to be suppressed until the FX launcher is fixed and in sync.
Kevin, do you have any thoughts on the matter?
More information about the core-libs-dev