except that is is possible your class files are in multiple directories, especially if you are using third party packages. you can't CD into more than one at a time, so the classpath lets you list as many as you need.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
posted 7 years ago
Ah I see. Now I know the purpose of the switch. How do you list multiple class paths in the one javac invocation? Also, is it true that any source files in the working directory are compiled as well?
In the above command the only class compiled is HelloWorld.java
If you want multiple locations to be specified in the classpath switch you separate them using a ;. Even in the above command there are two locations set as the classpath. One is the 3rdPartyCode\classes\ folder and the other the current working folder specified by the .
I believe all java source files present in the current working folder will be compiled only by the command javac -cp . *.java and not other wise.