Home > Net >  Eclipse IDE Error: Could not find or load main class javafx.fxml Caused by: java.lang.ClassNotFoundE
Eclipse IDE Error: Could not find or load main class javafx.fxml Caused by: java.lang.ClassNotFoundE

Time:02-22

I am using Eclipse IDE and trying to configure it to fun javafx for the first time. At first I was getting the error message for javafx.controls, after deleting the javafx sdk library from the build path it fixed that error and now i have this one. i have of course installed the e(fx)clipse plugin. Im trying to be thorough in what all I have tried to fix the issue.

I have looked through multiple forums and tried many different approaches. I have added vm arguments to my run configuration:

--module-path "C:\Downloads\openjfx-17.0.2_windows-x64_bin-sdk\javafx-sdk-17.0.2\lib" --add-modules javafx.controls, javafx.fxml

i have added my user library to the build path with the appropriate jars. I have deleted the javafx sdk lib from the build path. There are no errors visible in the editor. I have been trying to fix this problem yesterday and today as well for hours! Also here is my module-info code bc i saw in one forum where this was a problem for someone so ill add that info in as well.

 module Test {
      requires javafx.controls;
      requires javafx.fxml;
 
      opens application }

Javafx editor/buildpath screenshot--no errors/shows_jars

CodePudding user response:

The error message indicates that a VM argument is being treated as your main class name.

You have spaces in a VM argument value.

Separate the added module names by a comma, not a space or comma and space.

Also know that you don’t need add-modules when you have a module-info.java.

If you continue to have issues getting a basic JavaFX app to run

If you haven’t been able to get this working after trying for hours, then download Idea and use the new JavaFX project wizard.

If you wish to continue with Eclipse, then ignore instructions you find in forum posts. Instead, exactly follow the official documentation at openjfx.io.

  • Related