I got a bit of a struggle setting up IntelliJ for a JavaFX project.
I set it up using File > Project Structure > Libraries > Add new library > From Maven searching for org.openjfx:javafx-fxml:11.0.2
. So it was found and I deliberately checked Download JavaDocs since this would be useful.
However, when I tried to start the project, I got the following error:
java.lang.module.FindException: Two versions of module javafx.graphics found in lib (javafx-graphics-11.0.2-linux.jar and javafx-graphics-11.0.2-javadoc.jar)
Apparently the compiler mistoke javadoc for another version...
When I then removed the *javadoc.jar files downloaded for JavaFX the program started just fine. As you can imagine, I would like to keep the possibility to read JavaDoc directly in my IDE.
Any ideas how to fix that?
Edit: Here is a sample repo at Github: leun4m/javafx-demo@2a7a03a
Run Configuration:
--module-path lib --add-modules javafx.controls,javafx.fxml
I managed to make to compile, run and get docs in your project by doing next:
Adding a pom.xml to the root:
4.0.0
<groupId>org.example</groupId>
<artifactId>java-fx-pom</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>1.13</java.version>
<maven.compiler.source>13</maven.compiler.source>
<maven.compiler.target>13</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
javafx:run -f pom.xml