• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

new to Tomcat and JSP&Java Servlet,pls help

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have downloaded Tomcat4 and have got it run. But when I tried to compile Java servlet file, it gave errors like
HelloWorld.java:4: package javax.servlet does not exist
import javax.servlet.*;
my jdk is in c:\jdk1.3.1, tomcat is in c:\tomcat4, JAVA_HOME=c:\jdk1.3.1 and TOMCAT_HOME=c:\tomcat4. And I already setup CLASSPATH=.\;C:\JDK1.3.1\LIB\TOOLS.JAR\;
I searched this site's related threads, they talked about setting up classpath also to CLASSPATH=c:/tomcat/lib/servlet.jar
,But I can not find the servlet.jar file in the correspond directory c:/tomcat4/lib/, What should I do? Can you please give me some advice?
Any reply is highly appreciated!
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, you need those classes, but they can be found in either servlet.jar or j2ee.jar
Servlet.jar should already exist in TOMCAT_HOME/common/lib and you can add this to your classpath or drop servlet.jar in your JAVA_HOME/lib directory
Dave.
 
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kathy:
I had this problem too. You know what! I pulled half of my hair out to solve this problem.
Please follow as bellow you will have less pain.
Copy servlet.jar file from tomcat4\common\lib\[copy file servlet.jar] and paste it at jdk1.3\jre\lib\ext\[paste at here servlet.jar file].
It will solve your package javax.servlet does not exist
import javax.servlet.*;
By the way, Have you try tomcat sample servlet examples? Are they running? If they are you are all set, now rock and roll. Otherwise you got to set calsspath for CATALINA_HOME = tomcat4.0 . My best advise for all these go through tomcat docs. It takes time but comes out.
I wish there were book like "Tomcat Installation for Dummies", I would have been first guy to reserve first copy of their first publication. It was lot pain. I do not want to see other people marching this route. If you need more information keep posting.
GOOD LUCK. BK

Hi,
HelloWorld.java:4: package javax.servlet does not exist
import javax.servlet.*;


 
Kathy Wang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dave and BK!
BK, I did run the sample servlet, they did not run either. You mean I need to add: set classpath=c:\tomcat4; ?
If there were a book "Tomcat Installation for Dummies", I will do the same thing as you. But right now, I will follow your advice and keep reading the tomcatdocs. Thanks again.
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kathy, try copying servlet.jar to your jdk1.3.1/jre/lib/ext directory

Bosun
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SET JAVA_HOME=C:\JDK1.3
SET CATALINA_HOME=C:\TOMCAT4.0
SET PATH=%JAVA_HOME%\BIN;%CATALINA_HOME%\BIN;
SET CLASSPATH=%CLASSPATH%;C:\mydir\servlet.jar;
Startup.bat
Now check as:
localhost:8080 Tomcat's index page must be there..
Write me back if any problem.

------------------
I am before you to see you!!!
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic