The following explanation will work on WINDOWS environment.
If you have to set the classpath do the following steps...
1. Locate the directory where your java executables are existing (For eg. the default directory when you install will be c:\j2sdk1.4.0
If you are using some other version of java then that path like c:\jsdk1.2.0 )
2. Once you have located the path write it down in a piece of paper for easy reference.
3. Open Autoexec.bat file which is located in your C:\ drive. If it is not there create one.
4. In that give the following lines.
5. Save your autoexec.bat file.
6. Reboot(Restart the system)
Now this will define the classpath.
Why classpath is needed???
To run the application java needs to know where the bin and include libraries are located. To compile your application or to run your application java needs libraray and include files.
By defining the classpath you are showing executables located in the specific directory