-
Enhancement
-
Resolution: Fixed
-
P3
-
8
In JDK 7 / FX 2.x main() is not called for applications packaged up with the javafx packager. It is also not called for Web Start applications (or applets). With the added FX support in Java 8, the Java launcher now bypasses main() for FX applications even if they are run from class files or from a jar file not packaged by the javafxpackager.
Note that we made a deliberate decision to dicourage / deprecate the main() method. This JIRA proposes to revisit this decision.
Pros:
Applications that don't use the javafxpackager will expect main to be called and may be surprised when it isn't.
Cons:
This goes against the goal of unifying the application startup model, since the main method would be called for standalone apps, but not called for applets and web start apps.
If we decide to do this, it should be a fairly simple change in the launchApplicationWithArgs() method, which is called by the FX application helper. It could detect whether a main method is present. Is so, it would startup the toolkit and call the main() method. It would need to set a flag indicating that the toolkit was started in this fashion so the launchApplication() method (which would then be called by main) would not try to start it again. If no main method is present, it would call launchApplication() as it does now.
Note that we made a deliberate decision to dicourage / deprecate the main() method. This JIRA proposes to revisit this decision.
Pros:
Applications that don't use the javafxpackager will expect main to be called and may be surprised when it isn't.
Cons:
This goes against the goal of unifying the application startup model, since the main method would be called for standalone apps, but not called for applets and web start apps.
If we decide to do this, it should be a fairly simple change in the launchApplicationWithArgs() method, which is called by the FX application helper. It could detect whether a main method is present. Is so, it would startup the toolkit and call the main() method. It would need to set a flag indicating that the toolkit was started in this fashion so the launchApplication() method (which would then be called by main) would not try to start it again. If no main method is present, it would call launchApplication() as it does now.
- blocks
-
JDK-8119292 QuantumToolKit isSupported throws NullPointerException if Application.setUserAgentStylesheet called before Application.launch
- Closed
- relates to
-
JDK-8177294 add command line switch for JavaFX Application vs main()
- Closed
-
JDK-8095280 Thread classloader gets lost through the JFX launch process
- Resolved
-
JDK-8124368 Problems with Application static objects and pipeline initialization
- Resolved