I am having the following situation:
Module Address:
module org.abondar.experimental.address {
exports org.abondar.experimental.address;
}
Module Person:
module org.abondar.experimental.person {
requires org.abondar.experimental.address;
exports org.abondar.experimental.person;
}
I am building them using Maven, so every module has it's own target dir with jar file.
I am trying to run module Person which has main class like this
java --module-path Address/target/Address-1.0.jar;Person/target/Person-1.0.jar -m org.abondar.experimental.person/org.abondar.experimental.person.Main
But I am getting permission denied. How do I need to set up module path including several modules?
java all libraries must be added to modulepath.
Well trying this on one of my projects with MacOS, I almost ended up with something similar as this -
zsh: permission denied: .../.m2/repository/test/test/1.0.0-SNAPSHOT/test-1.0.0-SNAPSHOT.jar zsh: permission denied: .../.m2/repository/org/slf4j/slf4j-log4j12/1.7.12/slf4j-log4j12-1.7.12.jar zsh: permission denied: .../.m2/repository/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar
The reason for that error is that the paths to the JARs are specified as a command to be executed on MacOS instead.
If you consider the module path as a list of directories for MacOS(might be Unix in general) it doesn't match the java
tool documentation. Instead what you could seek for is
java --help
which states
--module-path <module path>
... A : separated list of directories, each directory is a directory of modules.
and in that case the command that shall work for you shall be :-
java --module-path Address/target/Address-1.0.jar:Person/target/Person-1.0.jar -m org.abondar.experimental.person/org.abondar.experimental.person.Main
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With