Compiling modules from terminal

Hello! I’ve been having hard time to compile java modules from the command line. I’m ready to buy a course related to compiling java using command line.

What operating system are you using? Windows, MacOS, some form of Linux/Unix?

Im using MacOS,

Error occurred during initialization of boot layer
java.lang.module.ResolutionException: Module mymain contains package com.animalpackage, module myanimal exports package com.animalpackage to mymain