c:\javac -cp dirA\dirB\dirC\A.java
and
2:-c:\java -cp \dirA \dirA\dirB\dirC\A.java
The above both statements do not execute on my machine (jdk 1.4) and the error is "invalid flag: -cp".
But instead of
-cp if I
-classpath flag is used then the error as stated by you
no source files is thrown.
Here is the explanation:
In your first case : the classpath variable was set to dirA\dirB\dirC\A.java and you did not specify any source files after that to execute. Afte the classpath is set you need to specify the source files. Try this it will work
c:\javac -cp dirA\dirB\dirC\A.java dirA\dirB\dirC\A.java The first argument is for classpath and the second argument is the source file which when compiled using classpath dirA\dirB\dirC\A.java
Comming to the second case which works : This is because now the classpath points to \dirA and the next argument is the source file that needs to be executed. The space between \dirA and \dirA\dirB\dirC\A.java acts as delimiter for the input arguments for the javac command.
If your in the same directory as the source files; you need not give classpath, just execute.
My feeling is that you have been confused with classpath and sourcepath.
check the javac help.