How to create a JavaFX Maven project in IntelliJ IDEA?

前端 未结 5 1864
花落未央
花落未央 2021-02-04 01:58

How can I open a JavaFX Maven project from scratch in IntelliJ IDEA? As there is no difference between a Java project and a JavaFx project, I want to open a dedicated JavaFX pro

5条回答
  •  有刺的猬
    2021-02-04 02:06

    For anyone coming here. I think the best answer lies on the openjfx docs. It contains a separate section for JavaFX & InteliJ, select the Non modular with Maven section.

    Ill describe the steps in breif.

    1. Create new Maven project.
    2. Select create from archtype.
    3. Add new archtype ( groupid : org.openjfx , artifactId : javafx-maven-archetypes , version 0.0.1 )
    4. Select the created archtype and Next.
    5. Provide group id org.openjfx ArtifactId hellojavafx and Next.
    6. Change the property archtypeArtifactId value to javafx-archetype-fxml.
    7. Add new property for javafx version : property javafx-version and value : 14.
    8. Finally give a name to project like HelloJavaFX.
    9. Now click finish and wait for inteliJ to build the project.

    Once InteliJ finish its work the pom should look like this sample.

    PS : Two more additional tips you need to follow if you follow this approach to get things going smoothly. JavaFX 14 needs java 11 or newer. Change the javax maven plugin version to 0.0.1 to 0.0.4 to avoid errors like invalid flag --module-path. Also to work better Download and install the

提交回复
热议问题