CodexBloom - Programming Q&A Platform

Eclipse 2023-09: JavaFX Application Launching implementing JDK 17

👀 Views: 186 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-14
javafx eclipse jdk17 maven java

I'm working on a personal project and Quick question that's been bugging me - I'm relatively new to this, so bear with me. I'm working with a frustrating scenario where my JavaFX application doesn't launch correctly in Eclipse 2023-09 after switching to JDK 17. The project built fine using JDK 11, but now when I try to run it, I get the following behavior: ``` Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: javafx/application/Application at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1180) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1021) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:921) ... ``` I have ensured that I added the JavaFX libraries to my project build path and configured the VM arguments to include the path to the JavaFX modules. My `Run Configurations` look like this: - **VM Arguments**: ``` --module-path /path/to/javafx-sdk-17/lib --add-modules javafx.controls,javafx.fxml ``` Despite these configurations, the application still fails to start. I've checked that the JavaFX SDK is indeed at the specified path, and I even tried cleaning and rebuilding the project multiple times. The `pom.xml` for my Maven project has the following dependencies for JavaFX: ```xml <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-controls</artifactId> <version>17.0.0</version> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-fxml</artifactId> <version>17.0.0</version> </dependency> ``` I also tried running the application from the command line using the same VM arguments, and it works perfectly. It seems this scenario is isolated to the Eclipse environment. Has anyone encountered similar issues or found a solution for getting JavaFX applications to run correctly with JDK 17 in Eclipse? I'd really appreciate any guidance on this. For reference, this is a production service. How would you solve this? Has anyone dealt with something similar?