-1

I'm getting this error on JavaFX: "Error: Could not find or load main class Main.java Caused by: java.lang.ClassNotFoundException: Main.java"

All the solutions I have tried to follow online haven't worked, and I'm very stuck. I've already added --module-path "<path to file>\javafx-sdk-17.0.2\lib" --add-modules javafx.controls,javafx.fxml in the VM arguments as trying some other solutions, but none of them changed anything. I've even tried reinstalling JavaFX from scratch and setting it all up again, and nothing changed.

Uwe Allner
  • 3,399
  • 9
  • 35
  • 49
  • What command are you running? What’s the package of your Main class? In which directory are you running the command? – Bohemian Jan 29 '22 at 17:43
  • If you are using Eclipse _Run configuration_ to run your code, then in the _Run Configurations_ window, click on the **Show Command Line** button. Then copy the text of the command and add it to your question. Refer to this [image](https://imgur.com/a/XJ4ld3S) – Abra Jan 29 '22 at 17:50
  • 1
    The docs are your friend: https://openjfx.io/openjfx-docs/ – mipa Jan 29 '22 at 18:06

1 Answers1

1

Sorry, I cannot comment, so I have to answer. The error you get sounds like you try to load a class named Main.java. However, the name should simply be Main.

PHolzwarth
  • 327
  • 1
  • 5