• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Problem compiling Servlet

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
clyde jones
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic