You can follow the following steps to compile and run your java program. 1. Suppose c:\myjava is the directory where you store all your java files. So if you have a java program "Hello.java" then its path should be c:\myjava\Hello.java . 2. Set the PATH ( I am saying PATH not the ClassPath ) environment variable to your "java home/bin" i.e. your PATH setting should look like PATH = %PATH%; c:\jdk1.3\bin; 3. On DOS prompt when you try to compile or run java program then change your directory to "C:\myjava" i.e. your C: prompt will look like C:\myjava> 4. First compile your .java file like C:\myjava>javac Hello.java 5. To run it C:\myjava>java Hello If you follow above steps to compile and run java programs you don't need to set or pass ( using -cp switch ) any CLASSPATH while compiling your java programs.