Is it a JSP or Servlet?
Well, these two packages aren’t actually built into Java like java.io is. Instead, they come with the Servlet-capable Web server (e.g. Tomcat). So before the Java compiler will be able to compile our Servlet, we need to let it know where to find the classes in these two packages.
The classes required are normally stored in a file called servlet.jar. The exact location of this file will depend on the particular Web server software you use, but in the case of Tomcat you can find it in the lib subdirectory of the main Tomcat installation directory (e.g. d:\Program Files\Apache Group\jakarta-tomcat-3.2.3\lib\servlet.jar). For the Java compiler to be able to compile Servlets, you need to add this file to your Java class path. By default, Java looks for classes in the current directory (".") only. Thus, "." is the default class path. If you change the class path to include the servlet.jar file (".;d:...\lib\servlet.jar" under Windows, ".:/usr/.../lib/servlet.jar" in Unix), then the Servlet should compile just fine.
You can specify a class path to use when you run javac.exe as follows:
d:\javadev> javac -classpath ".;d:\Program Files\Apache Group\ jakarta-tomcat-3.2.3\lib\servlet.jar" MyServlet.java
Or in Linux javac uses : instead of ;
server1> javac -classpath ".:./servlet/servlet.jar" MyServlet.java