Search code examples
javafxjvm-argumentsmodule-path

How to avoid adding vm arguments everytime I create a new javafx project?


I am creating javafx projects in STS(4.6.1) with e(fx)clipse plugin and scenebuilder.

Everytime I create a new project, I have to add the VM arguments in run configurations:

--module-path "/home/path/to/javafx sdk/lib" --add-modules javafx.controls,javafx.fxml

otherwise the program ends with the error message which says

Error: Could not find or load main class application.Main
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

I have to do this for every javafx project which is irritating.

Is there a way to add this once and for all?

Thanks


Solution

  • You can create your own variable in Eclipse with the specific value. When you need this value you can then choose from the variables list and add it to VM arguments by creating a variable in Eclipse to store the VM arguments.