If all you want to do is run your main class (without compiling the .java
files on which the main class doesn't depend), then you can do the following:
cd <root-package-directory>
javac <complete-path-to-main-class>
or
javac -cp <root-package-directory> <complete-path-to-main-class>
javac
would automatically resolve all the dependencies and compile all the dependencies as well.