My java project has 4 modules in directory project\src\x\y\z
. A compile with maven or with javac -cp src\x\y\z src\x\y\z\*.java
works (i.e. completes with no errors) and the timestamps indicate the class files were recreated, but
javac -cp src\x\y\z src\x\y\z\MainClass.java
fails with unable to find symbol errors where symbol is one of the other class names.
Attempting to run MainClass after a successful compile fails with cannot find MainClass error. (java -cp src\x\y\z src\x\y\z\MainClass
)
Each module includes a package x.y.z;
statement. If I move the java modules to another folder and remove the package statements compiles and execution are both successful.
What is going on and can it be fixed?