RFR 8004547: Extend JavaFX launcher support... (original) (raw)

Kevin Rushforth kevin.rushforth at oracle.com
Sat Dec 22 01:52:53 UTC 2012


Inline...

David DeHaven wrote:

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 LMCLASS to launch the application, not LMJAR. 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. LMCLASS). I think the semantics there was not obvious why it is not LMJAR mode but JAVAFXLAUNCHMODExxx has a different semantics than LMJAR and LMCLASS 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 LMJAR 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 "LMJAR" 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?

If that what Mandy is asking then it might make sense (I see no way we could use LM_JAR for java -cp fxapp.jar FxClass). I'm not sure what the implications are, though. It seems like it might complicate the logic in the FX launcher since we would have to add logic to handle both the presence and absence of JavaFX-Application-Class, but it might not be too bad. One case to consider is that in the absence of JavaFX-Application-Class, an FX application specified via Main-Class would behave differently if there was a main() method (in that case the main method is called and we wouldn't even get to the FX launcher, right?) versus if the main() method were not present. Or am I missing something?

I'll be on vacation for the rest of the year, so won't be able to discuss this idea in detail until after then.

-- Kevin



More information about the core-libs-dev mailing list