-1

I'm trying to run a JavaFX app through CMD but I can't make it work. What I did so far:

1) followed this guide and added the new environment variable (the JavaFX folder is in the desktop, does this make a difference?)

2) Tried to compile with javac --module-path %PATH_TO_FX% --add-modules javafx.controls HelloFX.java The HelloFX app is here

But I get an error saying "Module not found: JavaFX.controls". Does somebody know how can I solve that? (Also Javafx.controls.jar is in the JavaFX's lib folder).

Lorenzo
  • 111
  • 3
  • 10
  • Reboot computer after set variables to PATH. https://stackoverflow.com/questions/54055598/module-not-found-javafx-controls – titikaka Apr 25 '20 at 07:53

3 Answers3

0

OK I found a solution: if instead of %PATH_TO_FX% I put the full path to the JavaFX's lib folder (as an example: "C:\Desktop\JavaFX12.0.1\lib") being careful to put the path in the quotation marks, it works.

I don't understand why this happens so if somebody knows I would be thankful if they could share.

Lorenzo
  • 111
  • 3
  • 10
0

Lorenzo's solution works for me, the path of javafx lib goes in compile and then run command instead of %PATH_TO_FX% with "path".

Practically:

for compile(with my javafx lib path):

javac --module-path "C:\Program Files\javafx-sdk-14\lib" --add-modules javafx.controls HelloFX.java

for run:

java --module-path "C:\Program Files\javafx-sdk-14\lib" --add-modules javafx.controls HelloFX
0

My solution on Mac was:

Compile:

javac --module-path Java/javafx-sdk-18.0.1/lib --add-modules javafx.controls fileName.java 

Run:

java --module-path Java/javafx-sdk-18.0.1/lib --add-modules javafx.controls fileName 

JavaFx path: Desktop/Java/javafx-sdk-18.0.1/lib. (As the Java folder is on the Desktop and I have previously configured my directory to the Desktop, the path began with the folder name without the simple slash </>.)