if you are using MS-Dos prompt to compile and execute your program
You need to add tools.jar itself to the classpath, not just the directory it
is in, in your system environment.
set classpath="c:\jdk\lib"
where jdk is directory where jsdk is installed.
Or
download the edition of java "JCreator" from www.jcreator.com
It is free, install it , it automatically fix the classpath in its own
environment.
Or
Go through the link
forum.java.sun.com/thread.jsp