Skip to content

Grant JavaFX native access to silence Java 25 launch warnings#99

Merged
walterxie merged 1 commit into
masterfrom
fix/beauti-classloader-and-example-packaging
Jun 18, 2026
Merged

Grant JavaFX native access to silence Java 25 launch warnings#99
walterxie merged 1 commit into
masterfrom
fix/beauti-classloader-and-example-packaging

Conversation

@alexeid

@alexeid alexeid commented Jun 18, 2026

Copy link
Copy Markdown
Member

Problem

On Java 25, launching any GUI app (BEAUti, AppLauncher, etc.) prints:

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 (jrt:/javafx.graphics)
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

JavaFX loads its native libraries via System::load. Without native access explicitly granted, Java 25 warns — and a future release will block the call outright, which would break the GUI.

Fix

Add --enable-native-access=javafx.graphics,javafx.media,javafx.web next to the existing --add-modules ...javafx... in every launcher:

  • Linux release/Linux/linuxbin/*
  • Mac release/Mac/macbin/*
  • Windows release/Windows/bat/*
  • The jpackage .cfg / wrapper-.app generators (release/Mac/build-sign-dmg.sh, release/Windows/assemble-bundle.sh) so packaged bundles stay in sync with the static scripts.

All three modules listed load native code and are guaranteed resolved (javafx.web → javafx.media → javafx.graphics), so no "Unknown module" warning is introduced. Targeting all three (rather than just javafx.graphics) prevents the same warning resurfacing from WebView/media later.

Reported by Remco testing the Linux user bundle.

JavaFX loads its native libraries via System::load, which on Java 25
prints a restricted-method warning and will be blocked outright in a
future release. Add --enable-native-access=javafx.graphics,javafx.media,
javafx.web alongside the existing --add-modules in every launcher
(Linux/Mac/Windows scripts) and in the jpackage cfg/wrapper generators
so packaged bundles stay in sync.
@walterxie walterxie merged commit d707382 into master Jun 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants