openjfx / samples

JavaFX samples to run with different options and build tools
BSD 3-Clause "New" or "Revised" License
594 stars 1.52k forks source link

NetBeans ignores module path in VM Options #45

Open mklinik opened 4 years ago

mklinik commented 4 years ago

I followed the instructions on how to set up a JavaFX project in NetBeans (Non-modular from IDE) https://openjfx.io/openjfx-docs/#IDE-NetBeans, but running the program did not work.

I added a global library, and added the JavaFX jar files as described in the guide. I then created a new project and added the global library to the compile classpath, and set the VM Options to the module path on my system --module-path /usr/share/openjfx/lib/ --add-modules javafx.controls.

When running the program I got the error message java.lang.module.FindException: Module javafx.controls not found. It seems that NetBeans ignores the option --module-path in Project Settings / Run / VM Options. Instead, I added the JavaFX global library under Project Options / Libraries / Run / Modulepath, and only the option --add-modules javafx.controls to VM Options. Doing so makes the program compile and run just fine.

I tried it both on Linux and Windows, and got the same error message and same solution. NetBeans 11.2, JDK 13, several different versions of openjfx.

When compiling and running the hello world JavaFX project from the command line with javac and java directly, --module-path works just fine, so it does not seem to be a problem with my installation.

Maybe you want to update the instructions in the guide.

Zharks commented 4 years ago

This worked for me, thank you!

nvaranki commented 3 years ago

Take a look on [solution]https://github.com/openjfx/openjfx-docs/issues/115]. It works.