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

Javafx apps built with jpackage run on "AppKit" thread

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Mac OS X / Java 14 / Javafx 14

      A DESCRIPTION OF THE PROBLEM :
      I noticed something weird when running a Javafx app that built by jpackage for Mac OS X.
      Normally the start() method runs on Javafx Application Thread, but calling certain methods will result in start() running on "ApptKit" thread instead.

      REGRESSION : Last worked in version 8u251

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create any normal Javafx class, but call certain methods in the main() method.
      I could duplicate the problem in at least 2 ways, by add the following lines to main method of any Javafx application:

      - Desktop.getDesktop.setOpenFileHandler()
      - Or, new JGoogleAnalyticsTracker(); // Google analytics library

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Javafx Application
      ACTUAL -
      ApptKit

      ---------- BEGIN SOURCE ----------
      public class Test extends Application {

          public static void main(String[] args) {
              Desktop.getDesktop.setOpenFileHandler( e -> {});
              launch(args);
          }
          
          public void start(Stage stage) {
              System.out.println(Thread.currentThread().getName());
          }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Remove the call to Desktop.getDesktop.setOpenFileHandler( )

      FREQUENCY : always


            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: