0

I tried installing javaFX on my eclipse and it worked fine at first. Then I decided I want to make a specific JRE to save me from doing all the extra steps (adding user library each time, etc..) and I think I followed the tutorial well but now the programs won't run and I get this message from the JVM launcher: (Error:--add-- modules requires modules to be specified) note: the compilation works fine but after running it that happens

I'm not very experienced with these types of things and I have no idea what I did wrong so please ask me for any necessary details any suggestions? the window that appears

3
  • From the java man page (docs.oracle.com): "-add-modules module[,module...] Specifies the root modules to resolve in addition to the initial module. module also can be ALL-DEFAULT, ALL-SYSTEM, and ALL-MODULE-PATH." Commented Dec 31, 2022 at 23:47
  • Do you have any idea what I should add/edit then? Commented Dec 31, 2022 at 23:50
  • Haven't tested it, but this (gist.github.com) seems to address the issue. Commented Dec 31, 2022 at 23:53

1 Answer 1

2

Information on VM arguments for adding modules is in the documentation:

  1. Add VM arguments To solve the issue, click on

    Run -> 
    Run Configurations...  ->
    Java Application
    

    create a new launch configuration for your project named hellofx and add these VM arguments:

    --module-path "\path\to\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml
    

This should be done if the JDK or JRE you are using does not include the JavaFX modules in its base module layer (which applies to most common JDK or JRE distributions) and you are executing your application via the IDE (e.g. not via maven with the javafx-maven-plugin).

FAQ

Then I decided I want to make a specific JRE to save me from doing all the extra steps

You don't need to build your own JRE with JavaFX modules.

You can use a pre-built JRE (or JDK) that includes JavaFX:

With either of those, the JavaFX modules are included in the base JDK. That means you don't specify JavaFX libraries in build tool dependencies, or manually in the IDE, and you don't need compile or VM arguments for JavaFX modules.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.