Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error compoling servlets

 
rudolf hitler
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i keep gettin errors when compiling my servlet like javax.servlet package does nto exist what is the reason behind this i am using jdk1.3 to compile servlets
 
Debashish Chakrabarty
Ranch Hand
Posts: 231
Firefox Browser Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your servlet.jar file is not in classpath. This jar file is usually shipped with whichever webserver you might be using. You must add the folder containing this jar file to your classpath. For eg. both JSWDK and Java Web Server have this file in their lib directory.
Hope this helps
[ February 17, 2003: Message edited by: Debashish Chakrabarty ]
 
Gill Clover
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition to adding servlet.jar to your classpath, also make sure that the top of your Java class you need to import special libraries that servlets need to work,
i.e. import javax.servlet.*;
import javax.servlet.http.*;
A really good book (available online for free if you're skint, but well worth buying) on getting started with servlets is 'Core Servlets and JavaServer Pages' by Marty Hall, and the online version is available here.
HTH,
Gillian
[ February 17, 2003: Message edited by: Gillian Klee ]
 
rudolf hitler
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well guys it would be a great help if you could tell me exactly wht im suppose to put in my class path coz i put the servlet.jar in the classpath before posting my problem and it didnt work so i would like to know the exact value tht i am suppose to put in class path.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What *exactly* you put in your classpath is dependent on *your* system.

If you are using Tomcat 4.1.18 and your install directory is the default one provided by Tomcat's installation package, then add the following to your classpath...

C:\Program Files\Apache Tomcat 4.0\common\lib\servlet.jar

What OS are you using? If it's Win9x, then you need to use the DOS names for these directories (Progra~1)
 
Ivan Tamayo
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually put all these files, like servlet.jar, in this path:
JAVA_HOME\jre\lib\ext
JAVA_HOME is the directory where is installed the J2SDK, like c:\jdk1.3.1
 
rudolf hitler
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx for the help guys.
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A really good book (available online for free if you're skint, but well worth buying) on getting started with servlets is 'Core Servlets and JavaServer Pages' by Marty Hall


It's an excellent book because it explains how to set up your environment.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic