How to import javax.servlet.*;

Posted on 2004-11-06
Last Modified: 2008-02-01
Can someone tell me where i find the javax.servlet package. I am using Eclipse and when I include the import statement import javax.servlet.*; it says it cannot be resolved. searching in the package javax I find a lot of packages like security, sound, swing, xml,  but not javax.servlet. These  packages seem to be in the jar files in the jdk/jre/lib folder.

Bruce Mutch
Question by:bmutch
    LVL 27

    Assisted Solution

    servlet-api.jar   If you are using Tomcat then it is in  Tomcat/common/lib
    LVL 27

    Expert Comment

    You can download Tomcat from    
    for the Servlet 2.4 API  get  or   5.0.28.tar.qz

    Author Comment

    thanks I've got Tomcot, just need to know how to include the jar file in my project in Eclipse now that I know what the path is.

    Bruce Mutch
    LVL 27

    Expert Comment

    >how to include the jar file in my project in Eclipse
    Sorry, I don't use Eclipse.  Maybe someone will help.
    LVL 11

    Accepted Solution

    Did you say eclipse, (websphere) then you should have the javax library there you don't need to import it. It comes with rt.jar file.
    If you want to include the file then follow these directions:
    1. right click on your project folder inside the project navigation window (make sure you are running websphere and in the project)
    2. click on the properties
    3. It will open a new window Properties for 'yourProject'
    4. Select Java Build Path
    5. Click on Libraries
    6. Click on Add External JARs
    7. now select the jar file from the menu you want to select, and that's it.
    LVL 6

    Expert Comment

    1) download servlet.jar
    2) go to file -> new->project
    3) click on java project in the widow that opens up and do next
    4) specify the project name and do next
    5) go to the libraries and select "ADD EXTERNAL JAR" and specify the location of servlet.jar and do finish
    6) NOw run your code.

    LVL 2

    Expert Comment

    if you have already created you project :-
    1. rt clk on the project in the navigator and select properties.
    2. selelect "Java Build path" from the left hand box
    3. select libraries tab
    4. select "ADD EXTERNAL JAR" and specify the location of servlet.jar.
    5. click "Finish" button.
    you will then see the code being rebuilt.

    Author Comment

    thanks all , I awarded based on the first one to give new info.

    Bruce Mutch

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    For Sennheiser, comfort, quality and security are high priority areas. This paper addresses the security of Bluetooth technology and the supplementary security that Sennheiser’s Contact Center and Office (CC&O) headsets provide.  
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now