When compiling Java modules, developers often confuse --module-path with --source-path. While both are important, --module-path is crucial for successful module compilation.
In Java 9 and later, the --module-path tells the compiler where to find compiled modules and dependencies. In contrast, --source-path is used only for locating source files. Relying solely on --source-path without specifying --module-path can cause compilation failures when module-resolution is needed.
For modular Java projects, always include --module-path to ensure the compiler can resolve module dependencies correctly.