Nurtyleu Bahyt
Nurtyleu Bahyt

Reputation: 25

java.lang.module.FindException: Module test not foundIntellidea

I am have this Exception please help me! "Error occurred during initialization of boot layer java.lang.module.Find Exception: Module test not found"

But i write VM option "--module-path "D:\UT java\javafx-sdk-17.0.1\lib" --add-modules javafx.controls,javafx.fxml"

and i have module-info.java "

 requires javafx.fxml;
    requires javafx.controls;
    requires javafx.graphics;
    requires java.sql;
    requires java.desktop;
    requires jdk.jfr;"

i add my sdk. And if i create javafx demo project and execute him it work. and if i start change fxml file and change controller i have this exception. I have IntellIJIdea 2021, javafx-sdk-17.0.1, jdbc jr 8,11,16

Upvotes: 1

Views: 3786

Answers (1)

jewelsea
jewelsea

Reputation: 159566

Steps to fix:

  1. Delete the JavaFX sdk (you don’t need it).

  2. Delete old Java versions (they are obsolete).

  3. Update your IntelliJ IDE and IDE plugins to the most recent release, 2021.3.2+.

  4. Create a new JavaFX project using JDK and JavaFX 17.0.2+.

    • Select Maven for the build system unless you know and prefer Gradle.
  5. Do not set VM arguments, you don’t need them.

    • Adding modules via the --add-modules VM arguments is unnecessary when you have a valid module-info.java file.
    • The --module-path is still required so that the modules can be found, but Idea will provide the correct path for your modules automatically when it recognizes the modules through your Maven dependencies.
    • So you don't need to explicitly define the --module-path VM argument yourself for a Maven based build (that would be difficult to do anyway because the modules are all downloaded to different directories in your local maven repository).
  6. Test it works following the Idea create new JavaFX project execution instructions.

  7. Add additional modules one at a time by adding their maven dependency to pom.xml and the requires clause to module-info.java.

  8. Test between each addition by building and running the project, to ensure you haven’t broken anything.

  9. Copy your original source code into the appropriate package directories under the new project source directory:

    src/main/java
    
  10. Place resources in:

    src/main/resources
    

    following the Eden resource location guide.

  11. Fix any errors, ensure everything compiles and runs, then test it.

Upvotes: 3

Related Questions