I am trying to run a jdeps command on a project that uses OpenJFX, but it keeps failing.
The command I am using, simplified as much as I can:
jdeps --module-path Y:\javafx-jmods-11.0.2 --add-modules javafx.base Test.jar
javafx-jmods-11.0.2 is a directory containing the OpenJFX jmod files.
When I run this command, I get the error:
Exception in thread "main" java.lang.module.FindException: Module javafx.base not found
at java.base/java.lang.module.Resolver.findFail(Resolver.java:877)
at java.base/java.lang.module.Resolver.resolve(Resolver.java:128)
at java.base/java.lang.module.Configuration.resolve(Configuration.java:411)
at java.base/java.lang.module.Configuration.resolve(Configuration.java:245)
at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration.<init>(JdepsConfiguration.java:117)
at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:563)
at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:589)
at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:543)
at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:519)
at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:49)
Does anyone have any ideas or suggestions why it cannot find the javafx.base module, which is located in Y:\javafx-jmods-11.0.2?
Usually, when you get the error:
java.lang.module.FindException: Module ... not found
that means that the module-path is wrong (no valid path) or the path you have provided doesn't contain the required modules.
As you can see in the answer to Running javafx sample on JDK 11 with OpenJFX 11 JMODS on Module Path:
As explained here: http://openjdk.java.net/jeps/261#Packaging:-JMOD-files:
JMOD files can be used at compile time and link time, but not at run time. To support them at run time would require, in general, that we be prepared to extract and link native-code libraries on-the-fly.
What means you can't use jmods in combination with jdeps.
Solution
In this case, the solution is easy: use the jars from JavaFX SDK and not the jmods:
jdeps --module-path Y:\javafx-sdk-11.0.2\lib --add-modules javafx.base Test.jar