0

I'm following JavaFX documentation, but I think it is not updated for the latest version of their IDE. I'm using IntelliJ IDEA 2023.1 (latest), but tutorial is written for IntelliJ IDEA 2020.1 .

I'm trying to run the non-modular project for the first time, and here's what I did:

  • Downloaded JavaFX SDK v20 for Win X64, and extracted the zip file
  • Created new JavaFX project, and didn't check for any additional libraries when prompted in the following window IntelliJ IDEA new JavaFX project
  • Added JavaFX library via "Project Structure"

I'm stuck on step four, where I'm supposed to add VM options. I go to Run -> Edit Configurations, but my window is completely different than the one showed in the documentation, and I do not know where I'm supposed to enter the command --module-path "\path\to\javafx-sdk-20\lib" --add-modules javafx.controls,javafx.fxml.

Inside Run/Debug Configurations window, I did +Application, inside box for main class I selected com.example.demo.HelloApplication, and inside box for program arguments I put --module-path "\path\to\javafx-sdk-20\lib" --add-modules javafx.controls,javafx.fxml, where I did put my path to javafx lib dir.

When I tried to run my HelloApplication.java, I get the error java: module not found: javafx.controls, even though it's included as a parameter in the above mentioned command, i.e. part --add-modules javafx.controls,javafx.fxml.

I also followed documentation from JetBrains, which is up to date, and I still got the same error, i..e that modules are not found: IntelliJ IDEA error output

  • 3
    Seems you could simply create new JavaFX project and click on play button in editor without adding JavaFX library and setting VM options. – y.bedrov Apr 07 '23 at 11:49
  • Tried it. I get the same error, i.e. `java: module not found: javafx.controls` – jachai.sotaro Apr 07 '23 at 11:53
  • 2
    Use the "New JavaFX Project" Wizard. Try running the sample application. If it fails, post the complete stack trace, along with the code that generates the exception, your pom.xml and module-info.java files. – James_D Apr 07 '23 at 13:26
  • Stack trace https://pastebin.com/ujDhdRc8 `pom.xml` https://pastebin.com/Gt2w3R7W `module-info.java` https://pastebin.com/2Ub9TTWs – jachai.sotaro Apr 07 '23 at 13:48
  • 2
    Please post those in the question, formatted as code. I don't see the stack trace, just the module-info.java (twice) and the pom.xml. – James_D Apr 07 '23 at 15:18
  • 2
    *"I'm stuck on step four, where I'm supposed to add VM options."* If you really want to configure this manually, in the run configurations wizard click on "Modify Options" and make sure "Add VM Options" is checked. Then you should get a "VM options" box in the wizard and you can enter the VM options there. But this should not really be necessary. – James_D Apr 07 '23 at 15:24
  • I know it is a silly question, but did you replace `\path\to` with the actual path you put the sdk? Also are you on windows? In which case you should be using a Windows style path rather than Unix style. – jewelsea Apr 07 '23 at 19:30
  • Use released versions not `ea` early access versions. – jewelsea Apr 07 '23 at 19:32

0 Answers0