I switched to ubuntu 18.04. Which has java 10 as default jvm
Now my apps that use javafx cannot compile anymore.
cannot find symbol
[ERROR] symbol: class ObservableMap
I tried to add parameters to the maven-compiler-plugin to load the javafx.graphics module.
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>--add-modules</arg>
<arg>javafx.graphics</arg>
</compilerArgs>
</configuration>
</plugin>
result :
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] module not found: javafx.graphics
of course, java --list-modules | grep fx returns nothing.
I've spent more than 10 hours trying to figure this out.
TL:DR What am I supposed to do to compile my JavaFX modules with Java 10?
minimum project :
/pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<name>java10fx</name>
<artifactId>java10fx</artifactId>
<version>0.0.1</version>
<groupId>my.test</groupId>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>10</release>
</configuration>
</plugin>
</plugins>
</build>
</project>
/src/main/java/MyApp.java
import javafx.application.Application;
import javafx.stage.Stage;
public class MyApp extends Application{
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {}
}
error :
java10fx/src/main/java/MyApp.java:[1,26] package javafx.application does not exist