Description
I has been develop this cross-platform application skeleton but I have problems to run it with javafx:run
because this MOJO always add the javafx's JAR files in the modulepath.
Windows example command executed by javafx:run
> D:\tools\java\adoptopenjdk-11.0.4+11_hotspot\bin\java.exe
--module-path
D:\tools\maven-repository\org\openjfx\javafx-base\14\javafx-base-14-linux.jar;
D:\tools\maven-repository\org\openjfx\javafx-base\14\javafx-base-14-mac.jar;
D:\tools\maven-repository\org\openjfx\javafx-base\14\javafx-base-14-win.jar;
D:\tools\maven-repository\org\openjfx\javafx-controls\14\javafx-controls-14-linux.jar;
D:\tools\maven-repository\org\openjfx\javafx-controls\14\javafx-controls-14-mac.jar;
D:\tools\maven-repository\org\openjfx\javafx-controls\14\javafx-controls-14-win.jar;
D:\tools\maven-repository\org\openjfx\javafx-graphics\14\javafx-graphics-14-linux.jar;
D:\tools\maven-repository\org\openjfx\javafx-graphics\14\javafx-graphics-14-mac.jar;
D:\tools\maven-repository\org\openjfx\javafx-graphics\14\javafx-graphics-14-win.jar
--add-modules
javafx.base,
javafx.base,
javafx.base,
javafx.controls,
javafx.controls,
javafx.controls,
javafx.graphics,
javafx.graphics,
javafx.graphics
-classpath
C:\Users\Betanzos\Desktop\cross-platform-app-fx\target\classes
com.betanzos.Main
This may cause some problems due to overlapping modules (duplicated) which are not reloaded. For example, when I run the app in Windows, only the JAR javafx-graphics-14-linux.jar are loaded as javafx.graphics module so Windows libs are missing and the app exits (if I run the app in linux work fine).
We can see the problem if run the app adding the JVM parameter --show-module-resolution
(below output exclude all non related modules for simplicity):
...
root javafx.base file:///D:/tools/maven-repository/org/openjfx/javafx-base/14/javafx-base-14-linux.jar
...
root javafx.controls file:///D:/tools/maven-repository/org/openjfx/javafx-controls/14/javafx-controls-14-linux.jar
...
root javafx.graphics file:///D:/tools/maven-repository/org/openjfx/javafx-graphics/14/javafx-graphics-14-linux.jar
...
root javafx.fxml file:///D:/tools/maven-repository/org/openjfx/javafx-fxml/11.0.2/javafx-fxml-11.0.2-win.jar
...
javafx.fxml requires javafx.graphics file:///D:/tools/maven-repository/org/openjfx/javafx-graphics/14/javafx-graphics-14-linux.jar
javafx.fxml requires javafx.base file:///D:/tools/maven-repository/org/openjfx/javafx-base/14/javafx-base-14-linux.jar
javafx.fxml requires java.scripting jrt:/java.scripting
javafx.fxml requires java.xml jrt:/java.xml
...
javafx.graphics requires java.desktop jrt:/java.desktop
javafx.graphics requires javafx.base file:///D:/tools/maven-repository/org/openjfx/javafx-base/14/javafx-base-14-linux.jar
javafx.graphics requires java.xml jrt:/java.xml
javafx.graphics requires jdk.unsupported jrt:/jdk.unsupported
...
javafx.controls requires javafx.base file:///D:/tools/maven-repository/org/openjfx/javafx-base/14/javafx-base-14-linux.jar
javafx.controls requires javafx.graphics file:///D:/tools/maven-repository/org/openjfx/javafx-graphics/14/javafx-graphics-14-linux.jar
...
javafx.base requires java.desktop jrt:/java.desktop
...
Having said that it would be useful to add a way to run the application fully on the classpath.
Windwos command we want to execute with javafx:run
> D:\tools\java\adoptopenjdk-11.0.4+11_hotspot\bin\java.exe
-classpath
C:\Users\Betanzos\Desktop\cross-platform-app-fx\target\classes;
D:\tools\maven-repository\org\openjfx\javafx-base\14\javafx-base-14-linux.jar;
D:\tools\maven-repository\org\openjfx\javafx-base\14\javafx-base-14-mac.jar;
D:\tools\maven-repository\org\openjfx\javafx-base\14\javafx-base-14-win.jar;
D:\tools\maven-repository\org\openjfx\javafx-controls\14\javafx-controls-14-linux.jar;
D:\tools\maven-repository\org\openjfx\javafx-controls\14\javafx-controls-14-mac.jar;
D:\tools\maven-repository\org\openjfx\javafx-controls\14\javafx-controls-14-win.jar;
D:\tools\maven-repository\org\openjfx\javafx-graphics\14\javafx-graphics-14-linux.jar;
D:\tools\maven-repository\org\openjfx\javafx-graphics\14\javafx-graphics-14-mac.jar;
D:\tools\maven-repository\org\openjfx\javafx-graphics\14\javafx-graphics-14-win.jar;
C:\Users\Betanzos\Desktop\cross-platform-app-fx\target\classes
com.betanzos.Main