Hello All: I am getting following compilation error while compiling servlet from folder C:\jakarta-tomcat\webapps\examples\WEB-INF\classes\ValidateUser.java Package javax.servlet not found in import Package javax.servlet.http not found in import I have following setting on my NT machine CLASSPATH = c:\jdk1.2.2;c:\jakarta-tomcat\lib; JAVA_HOME = c:\jdk1.2.2; TOMCAT_HOME = c:\jakarta-tomcat; PATH = c:\jdk1.2.2;c:\jdk1.2.2\bin;c:\jakarta-tomcat\lib; Am I missing some settings ? Thanks
The files in jakarta-tomcat\lib are "jar" files. Tomcat is smart enough to pick them all up when it is running, but if you want to compile your servlets using a regular Java compiler you need either (1) all these to be in your classpath individually, or (2) all of them to be in the jre\lib\ext directory of your SDK if you are using Java 2.
Hi, What Frank said is correct. In addition to that note down one more point, to keep .jar files in classpath you have to mention the full path of the jar file name. For example if you want to put c:\tomcat\lib\xxxx.jar in your classpath you have to put the entire thing like classpath=%classpath%;c:\tomcat\lib\xxxx.jar;c:\tomcat\lib\yyyy.jar . You just can not put like c:\tomcat\lib May be because of this reason your compiler is not finding reqired classes. ------------------ Prasad
Joined: Oct 16, 2000
Frank, Prasad Thank you. I mentioned the full path of the jar file name in the CLASSPATH and it worked. Dilip