I can run a Java module from the command line without issues as follows:
java -p "dir/with/module1;dir/with/module2" -m my.module.name
//runs fine
However, when I reverse the arguments, putting -m (--module) before -p (--module-path), it doesn't work and results in the following error:
java -m my.module.name -p "dir/with/module1;dir/with/module2"
Error occurred during initialization of boot layer
java.lang.module.FindException: Module my.module.name not found
Is this expected behavior? Can someone confirm whether the order of the -p and -m arguments matters?
Here's my Java version for reference:
$ java --version
openjdk 11.0.12 2021-07-20 LTS
OpenJDK Runtime Environment Corretto-11.0.12.7.1 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.12.7.1 (build 11.0.12+7-LTS, mixed mode)