Basically the classpath is used for the Java compiler to search for the source files (.java) in the path/rootpath mentioned in the classpath variable.
Preety is almost correct. The classpath is used by the jvm (the java command) to search for the *.class files it needs to run the app.
The source files can be whereever you want them to be. When you compile them using javac (which needs to be in your path), by default the *.class files (the compiled files) go in the same directory. In this case, yes, you would need to have each source path in your classpath (or change your classpath each time).
I suggest that you always put your *.class files into the same subdirectory (maybe named "classes") to keep things simple, at least to begin with. Once you're up and running you can play around with the different switches that come with the "java" and the "javac" commands.
[ August 24, 2002: Message edited by: Marilyn de Queiroz ]