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

Error compoling servlets

rudolf hitler
Ranch Hand

Joined: Feb 07, 2003
Posts: 34
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

Joined: May 14, 2002
Posts: 230

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 ]

Debashish
SCJP2, SCWCD 1.4, PMP, ITIL Foundation
Gill Clover
Greenhorn

Joined: Aug 10, 2002
Posts: 28
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

Joined: Feb 07, 2003
Posts: 34
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

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Aug 13, 2001
Posts: 49
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

Joined: Feb 07, 2003
Posts: 34
thanx for the help guys.
Garrett Smith
Ranch Hand

Joined: Jun 27, 2002
Posts: 401

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.


comp.lang.javascript FAQ: http://jibbering.com/faq/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error compoling servlets