Closed EasyG0ing1 closed 1 year ago
After creating a question about this problem on stackoverflow.com, which can be seen here, I made the following adjustments to my project, which ended up fixing this issue, and now my project runs and MonacoFX works beautifully:
First, I had to add this to my module-info.java file:
requires javafx.web;
requires eu.mihosoft.monacofx;
Next, I changed my JDK in IntelliJ to use version 17.0.1 and I made these changes in my POM file:
<properties>
<java.version>17</java.version>
<javafx.version>17.0.1</javafx.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>net.synedra</groupId>
<artifactId>validatorfx</artifactId>
<version>0.1.13</version>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>eu.mihosoft.monacofx</groupId>
<artifactId>monacofx</artifactId>
<version>0.0.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</build>
</project>
This is related to Java modules. MonacoFX supports automatic-module names but does not include a module-ionfo.java. Therefore, if you choose to use the module system you are required to declare the dependencies.
Hello,
Using Java 16, if I simply create a new JavaFX application in IntelliJ, then add the Maven dependency for MonacoFX, then add this to the module-info.java file:
requires eu.mihosoft.monacofx;
Then add this one line to the starting class (which does run successfully without adding this line):
MonacoFX monacoFX = new MonacoFX();
I receive this error when I try to run the code:
Any ideas on how to fix it?
Thank you,
Mike