I have gone through the java 9 jigsaw tutorial. I have been struggling to run class, java throws below error-
java --module-path mods -m mods/com.test/com.test.HelloWorld
Error occurred during initialization of boot layer
java.lang.module.FindException: Module mods not found
Javac command-
javac -d mods --module-source-path src $(find src -name '*.java')
I am using mac, java version-
$ java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
Am I missing anything?
Remove additional mods from module name-
java --module-path mods -m com.test/com.test.HelloWorld
The -m
flag accepts the module name and the main class you want to run. The module name is com.test
, hence the command to run the class should be:
java --module-path mods -m com.test/com.test.HelloWorld
The --module-path mods
tells java
where to search for to find com.test
.
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