Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

Servlet error ...package Javax.servlet does not exist

Thread view: 
cormacdebarra@gmail.com - 10 Nov 2006 21:20 GMT
Hi,
I'm writing a simple servlet .. heres the code:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class BeerSelect extends HttpServlet
{

    public void doPost(HttpServletRequest request,HttpServletResponse
response)throws IOException, ServletException
    {

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("Beer Selection Advice<br>");
        String c = request.getParameter("color");
        out.println("<br>Got beer color " + c);
    }
}

but i get the packkage does not exist error. I'm using Tomcat 6.0 and
the servlet-api.jar is in the directory :
C:\Program
Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\common\lib

I've set the CLASSPATH to include this , this is my classpath:

......C:\jdk1.5.0_09\bin;C:\Program
Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\common\lib;

Anyone know what the problem is: ( by the way i'm using command prompt
to compile it)

Thanks
Manish Pandit - 10 Nov 2006 21:22 GMT
> I've set the CLASSPATH to include this , this is my classpath:
>
> ......C:\jdk1.5.0_09\bin;C:\Program
> Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\common\lib;

You need to qualify the jar file (include the jar file name) in the
classpath. Jars/Zips do not get included in the classpath
automatically, you need to provide the full name.

-cheers,
Manish
cormacdebarra@gmail.com - 10 Nov 2006 21:30 GMT
> > I've set the CLASSPATH to include this , this is my classpath:
> >
[quoted text clipped - 7 lines]
> -cheers,
> Manish

My classpath now looks like this:
C:\Program
Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\common\lib\servlet-api.jar;

but it still gives the same errors

Any ideas
thanks
www.pulpjava.com - 10 Nov 2006 22:34 GMT
The servlet-apis.jar, or j2ee.jar file, depending on your environment,
isn't on your classpath.

-Cameron McKenzie

Free Java Certification Mock Exams: www.scja.com
Free Java and J2EE Tutorials: www.mcnz.com

www.pulpjava.com www.examscam.com

> > > I've set the CLASSPATH to include this , this is my classpath:
> > >
[quoted text clipped - 16 lines]
> Any ideas
> thanks
Simon Brooke - 11 Nov 2006 13:55 GMT
>> > I've set the CLASSPATH to include this , this is my classpath:
>> >
[quoted text clipped - 7 lines]
> My classpath now looks like this:
> C:\Program

Files\netbeans-5.0\enterprise2\jakarta-tomcat-5.5.9\common\lib\servlet-api.jar;

> but it still gives the same errors

Is that where the servlet-api.jar actually is on your system? Is it called
exactly that?

Signature

simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/

       'graveyards are full of indispensable people'



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.