Skip to content
Advertisement

Unable to launch a java/javaFX code after a clone on IntelliJ

It’s very complicated to explain so sorry if it’s not clear. Basically, I’m on a group project in javaFX, and every time I clone it, my PC doesn’t recognize either Java or JavaFX on THAT project exactly. All the others work fine. So I have to do a lot of manipulation each time for it to “work” (I explain below).

And today I have clone because of an error. Except that impossible to make it work again.

What I did on IntelliJ after cloning:

-I reloaded the MAVEN project

-I imported the java libraries

-I put the right folder in ROOT

enter image description here

-I created the configuration

enter image description here

From there, Java and JavaFX are recognized. After that, I have other problems. In particular that of “The output path is not specified for module structure” and after that it redirects me to File -> Project Structure -> Project and compile output. Except that in my previous problems, I didn’t have to define a Compiler Output. Usually the steps above were enough. And the problem is that I have no idea what to put in this section. I searched all over the internet, but 90% of the time it’s an old version of IntelliJ and it was asking them for a path. There, I am asked for a file (impossible to choose a destination path, it is greyed out). And in CTRL C + V the path directly (for example an excluded “Out” folder like what I have read on the internet), I have this error at launch:

Error occurred during initialization of boot layer java.lang.module .FindException: Module start.structure not found

I want to re-specify that there is no error in the code, we have exactly the same with my team, and with them it works without worries.

If someone know how to resolve theses problems

Advertisement

Answer

This isn’t really fully answerable here in a general sense, because there are too many environmental and project-specific things that may occur.

Instead, I’ll provide a suggested approach for a new project:

  1. Create a new JavaFX project in Idea.

    • Choose Maven for the build tool.
    • Follow the execution instructions from the linked documentation to ensure the project runs in your environment.
  2. Share your new JavaFX project on GitHub.

  3. Clone the newly shared project to a new Idea project.

    • This is emulating somebody else checking out the project from GitHub.
  4. Run the newly checked out project in your Idea environment exactly as you did for Step 1.

That is really all you need to do to use JavaFX + Idea + GitHub.

A pre-existing project may require additional steps for configuration and use which may be project specific, so I can’t generally advise on that.


Some comments on the approach outlined in your question:

  1. You mention “every time I clone it”.

    • You only really need to clone a project once, after that you can just update it.
  2. The image has a folder ${project.build.directory}.

    • That looks wrong, kind of like an expansion variable name was applied literally rather than being expanded (I don’t know what you did to cause that).
  3. Your resources folder isn’t marked with a resources icon.

    • This indicates that you haven’t imported the project from Maven correctly.
    • Normally Idea will recognize a Maven project and import it automatically, mapping the standard directory structure, e.g. src/main/java is Java source and src/main/resources are resources.
  4. “I have put the right folder in ROOT”

    • I am not sure what that means, but it should not be necessary to manually configure things like this. As mentioned, Idea knows the standard Maven project structure and is able to apply it without manual intervention.
  5. “I created a configuration.”

    • You don’t need to create configuration manually.

    • The configuration you have created is wrong.

    • If you right-click on your JavaFX application class and choose run, an appropriate run configuration for the application will be created automatically.

    • The configuration does not need to specify a JavaFX SDK.

    • You don’t need to (and should not for this purpose), install a JavaFX SDK on your machine.

    • The configuration does not need to specify a module path or modules to add.

    • Idea and Maven are smart enough to know that:

      • your application is modular (because you have provided a module-info.java)
      • the required modules are provided as Maven dependencies (this includes the JavaFX modules that you need)
      • the modules should be placed on the modulepath (Idea and Maven will do this automatically, you don’t need to do anything manual for this to occur).
  6. For the message “The output path is not specified for module structure”:

    • I don’t know what this means, but, if you follow the suggested approach, you don’t need to manually specify an output path, Idea and Maven will automatically assign appropriate values and use them without user intervention.
  7. “Error occurred during initialization of boot layer java.lang.module .FindException: Module start.structure not found”

    • This indicates that you have specified somewhere that a module start.structure should be used and either:

      • Your application’s module (specified in its module-info.java) is defined using a different name.
      • Your application’s source code is not on the module path (perhaps it is mistakenly on the classpath instead).
      • Your apps module isn’t correctly added.
    • Usually Idea will be smart enough to know that you have a module-info.java and therefore to place your application code on the modulepath, so you don’t need to manually specify modulepath and add-modules options to find your application’s module.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement