A common practice is to add the package root to the classpath.
When you are already in the root directory of the package, use -cp .. For instance.
cd /path/to/all/packages
javac -cp . packageName/Main.java
JAR , ; ( * nix, :) :
javac -cp .;lib/file.jar packageName/Main.java
, .bat ( in * nix a .sh). IDE, java/javac ..