JavaFX Warning: "Unsupported JavaFX Configuration"
When using JavaFX, you might encounter the warning: "Unsupported JavaFX configuration: classes were loaded from 'unnamed module @...'". This warning arises due to changes introduced in Java 9's Java Platform Module System (JPMS).
Solution:
To address this issue, ensure that JavaFX is loaded as named modules, meaning it's included in the module-path. Here are several approaches:
1. Non-Modular Applications:
Use the --add-modules argument:
java --module-path <path-to-fx> --add-modules javafx.controls ...
2. Modular Applications:
Launch your application with the --module argument:
java --module-path <path> --module app/com.example.app.Main [args...]
3. Use a JDK Distribution that Includes JavaFX:
Install a JDK distribution that includes JavaFX, such as BellSoft Liberica JDK or Azul Zulu JDK.
4. Ignore the Warning (not recommended):
The warning does not currently cause any functionality issues with JavaFX. However, it's advisable to resolve it for proper module support in the future.
Deployment Options:
Main Class Note:
When JavaFX is loaded from the unnamed module, the main class should not extend javafx.application.Application. Instead, define a main class that launches the JavaFX application.
The above is the detailed content of How to Fix the \'Unsupported JavaFX Configuration\' Warning in Java 9 and Beyond?. For more information, please follow other related articles on the PHP Chinese website!