File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Servlet Compilation Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Compilation Error" Watch "Servlet Compilation Error" New topic
Author

Servlet Compilation Error

Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
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
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Prasad Charasala
Ranch Hand

Joined: Nov 02, 2000
Posts: 67
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


<B>Prasad</B>
Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
Frank, Prasad
Thank you. I mentioned the full path of the jar file name in the CLASSPATH and it worked.
Dilip
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Compilation Error
 
Similar Threads
Servlet compilation error
Servlet Compilation Error
Servlet Compilation Error
Problem running first servlet
new to servlets! plz help!!!