When you first compiled your code using javac command as-
javac -d mods --module-source-path src $(find src -name '*.java')
What you ensured using -d directory was that to
Set the destination directory for class files.
in your case the mods folder where
If a class is part of a package, then javac puts the class file in a
subdirectory that reflects the package name and creates directories as
needed.
Hence you can take a look at the mods directory after executing the command, the .class for all(*.java) would exist in the corresponding directory structure as of their package name.
Then java tool option --module-path module path or -p module path specified in your next command :
Searches for directories from a semicolon-separated (;) list of
directories. Each directory is a directory of modules.
Your listed directory according to which is mods, assuming which you must have created following the getting started link.
Followed by --module modulename[/mainclass] or -m module[/mainclass] in your command
Specifies the initial module to resolve and the name of the main class to execute if not specified by the module.
which in your case is the module name com.test and the main class com.test.HelloWorld.
Hence the complete correct syntax of the command shall be:-
java --module-path mods -m com.test/com.test.HelloWorld
^ ^ ^
module directory module name main class