I am not using any IDE and trying to compile the servlets through command prompt itself.
The environment variables i have set are as follows:
CLASS: C:\Program Files\Java\jdk1.7.0\lib;
CLASSPATH: C:\Program Files\Apache Software Foundation\Tomcat 7.0\common\lib\servlet-api.jar;C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\commons-fileupload-1.2.1.jar;C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\commons-io-1.3.2.jar;C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files\Java\jre7\bin;
JAVA_HOME: C:\Program Files\Java\jdk1.7.0;
Path: C:\Program Files\Java\jdk1.7.0\bin;
when i am trying to compile servlet program following error is coming
Make sure the above paths are correct, and the following two C:\Program Files\Java\jdk1.7.0\bin;C:\Program Files\Java\jre7\bin; should not be under classpath. The last two are Path environment variable.
Remove Class and ClassPath variables from environment variables. (Your "path" variable is alright)
Put servlet-api.jar pear to your servlet class.
and compile with "javac -cp .;servlet-api.jar YourServlet.java" (Considering that you only need a servlet-api.jar to compile your code, as it can be seen from the errors)