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

JavaFX applications must use `--enable-native-access`

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P3 P3
    • jfx24
    • jfx24
    • javafx

      JEP 472 [0] is a step along the path to restricting JNI access by default.

      When running JavaFX applications with JDK 24, the Java runtime emits the illegal access warnings of the following form:

      WARNING: A restricted method in java.lang.System has been called
      WARNING: java.lang.System::load has been called by com.sun.glass.utils.NativeLibLoader in module javafx.graphics (file:.../javafx.graphics.jar)
      WARNING: Use --enable-native-access=javafx.graphics to avoid a warning for callers in this module
      WARNING: Restricted methods will be blocked in a future release unless native access is enabled

      WARNING: A native method in com.sun.webkit.WebPage has been bound
      WARNING: com.sun.webkit.WebPage::twkInitWebCore is declared in module javafx.web (file:.../javafx.web.jar)
      WARNING: Use --enable-native-access=javafx.web to avoid a warning for native methods declared in this module
      WARNING: Restricted methods will be blocked in a future release unless native access is enabled

      WARNING: A native method in com.sun.media.jfxmedia.logging.Logger has been bound
      WARNING: com.sun.media.jfxmedia.logging.Logger::nativeSetNativeLevel is declared in module javafx.media (file:.../javafx.media.jar)
      WARNING: Use --enable-native-access=javafx.media to avoid a warning for native methods declared in this module
      WARNING: Restricted methods will be blocked in a future release unless native access is enabled

      In order to avoid those warnings, and to avoid the eventual errors in the future, applications must pass the --enable-native-access flag:

      --enable-native-access=javafx.graphics,javafx.media,javafx.web

      [0] https://openjdk.org/jeps/472

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: