classpath - when compiler makes use of that?
I am learning to set the classpath property. I have a source file say Test.java in the C:\MyLearning\Samples. I have set the environment variable CLASSPATH to C:\MyLearning\Samples. Now am running the Test.java file from the command prompt. The default user directory is shown. Now I tried running the file from there itself giving "javac Test.java".Its not working. But when am pointing to the same direcory where the source is,and then running the program,it works.Why this is so?The concept of classpath is once we set it,we can run the program from anywhere right?If my source is in d: drive,and I want run it from c: drive,is there any other option other than pointing to same direcory of d:?If this is the case,what is the purpose of classpath?am not including any additional jars or anything, but a simple program to run,what else needs to be done?