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 Problem compiling Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem compiling Servlet " Watch "Problem compiling Servlet " New topic
Author

Problem compiling Servlet

clyde jones
Ranch Hand

Joined: Dec 02, 2000
Posts: 46
Hi All,
I am using Tomcat 3.2.1 and am having a heck of a time compiling the servlet(s). I think I have a classpath problem, but I can't figure out where the problem is. If anyone can help me, I would appreciate it. Here is the classpath portion of my autoexec file:
set TOMCAT_HOME=C:\tomcat
set JAVA_HOME=C:\jdk1.3
set J2EE_HOME=C:\j2sdkee1.2.1
set CLASSPATH=C:\tomcat\lib\servlet.jar;.
set CLASSPATH=C:\tomcat\lib\jasper.jar;.
set CLASSPATH=C:\tomcat\webapps\root\web-inf\classes; %CLASSPATH%
set CLASSPATH=.;C:\java\lib\classes.zip;C:\java\lib\tools.jar;C:\JAVA\lib\rt.jar;
rem C:\java_Packages
rem set CLASSPATH= C:\java_Packages; .

Here is the message I get when I try to compile the servlet:
C:\jdk1.3\jspTests\K2MServlet.java:9: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
Thanks In Advance,
Clyde
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Ofcourse you will, this is what you need to know about
WINDOWS...
set CLASSPATH=C:\tomcat\lib\servlet.jar;.
set CLASSPATH=C:\tomcat\lib\jasper.jar;.
set CLASSPATH=C:\tomcat\webapps\root\web-inf\classes; %CLASSPATH%
set CLASSPATH=.;C:\java\lib\classes.zip;C:\java\lib\tools.jar;C:\JAVA\lib\rt.jar;

In the first stmt abv you set your CLASSPATH to C:\tomcat\lib\servlet.jar;.
That is correct. Then in the second line, you again set your
CLASSPATH to C:\tomcat\lib\jasper.jar;.
By this stmt, your previous CLASSPATH gets erased and the
CLASSPATH is set to the new one.
You need to APPEND (instead of overwriting) your CLASSPATH. To
do this under WINDOWS, you need to change your stmts to look
like this:
set CLASSPATH=C:\tomcat\lib\servlet.jar;.
set CLASSPATH=%CLASSPATH%;C:\tomcat\lib\jasper.jar
set CLASSPATH=%CLASSPATH%;C:\tomcat\webapps\root\web-inf\classes
set CLASSPATH=%CLASSPATH%;C:\java\lib\classes.zip;C:\java\lib\tools.jar;C:\JAVA\lib\rt.jar

Please observe the "%CLASSPATH%" after the first line.
HTH. Good Luck.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
clyde jones
Ranch Hand

Joined: Dec 02, 2000
Posts: 46
Madhav,
Thanks for your help on what may have been a simple situation for many to debug. Everything worked like a charm. This is truly a friendly place. Now on to hooking up Tomcat and Apache.
Clyde
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem compiling Servlet