Home >Java >javaTutorial >How to Resolve the \'Unsupported JavaFX Configuration: Classes were loaded from \'unnamed module @...\'\' Warning?
JavaFX: Unresolved Module Path for Classes
Problem:
Upon running a JavaFX application, a warning is displayed: "Unsupported JavaFX configuration: classes were loaded from 'unnamed module @...'"
Background:
With the introduction of Java 9's Platform Module System, JavaFX modules must be loaded as "named modules" rather than "unnamed modules." This warning indicates that JavaFX is being loaded incorrectly.
Solution:
Non-Modular Application:
<code class="java">java --module-path <path-to-fx> --add-modules javafx.controls ...</code>
Modular Application:
<code class="java">java --module-path <path> --module app/com.example.app.Main [args...]</code>
In the above commands, replace
Use JDK Distribution with JavaFX:
Install a JDK distribution that includes JavaFX, such as:
Ignore the Warning:
Although not recommended, you can choose to ignore the warning as it doesn't currently break any functionality in JavaFX 21. However, JavaFX may not be loaded correctly.
Main Class Restriction:
Note that when JavaFX is loaded from the unnamed module, the main class cannot extend javafx.application.Application. A separate main class is required to launch the JavaFX application.
Deployment Options:
The above is the detailed content of How to Resolve the \'Unsupported JavaFX Configuration: Classes were loaded from \'unnamed module @...\'\' Warning?. For more information, please follow other related articles on the PHP Chinese website!