Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8102035

Change launcher to always call the main method for standalone JavaFX applications

    Details

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kcr Kevin Rushforth
                Reporter:
                kcr Kevin Rushforth
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: