2

I wanna add JavaFX to an existing project in IntelliJ and followed this documentation.

I created a folder structure with an folder with an JavaFX project in it. If I open only this folder who contains JavaFX within IntelliJ everything gets imported correctly and the sample main is running. If I open the whole project where the folder with JavaFX is an subfolder only I get a lot of red and running the main results in many errors. How can I open a JavaFX project within another project in IntelliJ?

IntelliJ Project structure if it does work

GUI
+-- JavaFXRelatedFiles

IntelliJ Project structure if it does not work

+-- src
|   +-- GUI
|   +-- OtherFolder
2
  • Why do you wanna do that? you probably need to run your javafx project as main project and import the other stuff as a jar... Commented May 19, 2022 at 20:22
  • 2
    @JawadElFou developing using multi-module projects can be convenient in my experience. For a complex multi-layered system, you can manage it under a single build structure, git repository, and IDE project rather than having to manage different instances of each of those things manually. It is not the best approach for some projects, but it is a good approach for others. Commented May 19, 2022 at 21:09

1 Answer 1

5

Choose File | New Module... instead of File | New Project....

The setup of the new module after that will be similar to the new project, so you can just follow the instructions you linked for creating a new JavaFX project.

If you want to link the multiple modules together with a Maven build, that is much more complex (especially if you use both maven and java platform modules), so I won't describe that process here.

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.