JDK-8347744 : JavaFX applications must use `--enable-native-access`
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: other
  • Affected Version: jfx24
  • Priority: P3
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2025-01-14
  • Updated: 2025-10-07
  • Resolved: 2025-10-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx24Resolved
Related Reports
Blocks :  
Relates :  
Relates :  
Sub Tasks
JDK-8347745 :  
Description
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
Comments
Reopening to change the resolution to "Delivered", since a release note on an issue that is closed as a "Duplicate" is considered to be an invalid state by the tools that check release notes. Consequently, I will change the link to JDK-8331671 from "duplicates" to "is blocked by".
07-10-2025

This JBS issue is a placeholder for a release note that we will need for JavaFX 24. The change that actually implements this restriction is JDK-8331671 which was fixed in JDK 24, so this issue is closed as a Duplicate of that.
14-01-2025