Javax.servlet cannot be resolved - HELP

I am using Eclipse to develop a Servlet application but Eclipse cannot resolve the javax.servelet package. Is there a special j2ee package I am suppose to download or do all the j2ee packages come with the JDK? I am running J2SE 1.5. I did not download the JDK seperately because I assumed in came with Eclipse.
What do I have to do so that Eclipse can resolve the javax.servlet package and all j2ee packages?

Do you mean that I have to define a new Environment
variable in WinXP that point to the location of
servlet.jar?no
>
I don't have a servelet.jar file BTW.servlet.jar is a part of the j2ee download so if you
just have j2se it may not be there.
it is bundled with tomcat also and should be in the
<tomcat home>common/lib directory.
it is also bundled with netbeans in the directory
<netbeans home>/tomcat/common/lib
you can download it from sun and add it in the java home lib directory

Similar Messages

  • Getting an error like this The import javax.servlet cannot be resolved

    HI
    i am getting an error like this "The import javax.servlet cannot be resolved".wht i ahve done in eclipse right click->open->servlet->packge name->servlet name->next->nexyt>finish.hereinterfaces is javax.servlet.Servlet.
    do i need add jar for it.can any one tell me why i got error like this.
    vijay

    Please don't doublepost. Answer is given here: http://forum.java.sun.com/thread.jspa?threadID=5220686

  • Import javax.jms cannot be resolved

    This is error i am getting The import javax.jms cannot be resolved even though
    my class path contains mail.jar and activation.jar.
    please suggest me, to resolve above error
    Thanks in advance

    sir
    These below import packages are not resloved by class path
    import javax.jms.ObjectMessage;
    import javax.jms.Session;
    import javax.jms.Topic;
    import javax.jms.TopicConnection;
    import javax.jms.TopicConnectionFactory;
    import javax.jms.TopicPublisher;
    import javax.jms.TopicSession;
    and below packages are resolved
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;

  • Javax.ejb cannot be resolved

    Hey there, im using this code in my portal application:
    import javax.ejb.CreateException;
    Im using it to connect to a DataSource, but my NWDS keeps saying: Javax.ejb cannot be resolved. I tried several hints and tips from all over but i cant get it fixed. I added j2ee.jar to my classpath and to my NWDS config but nothing seems to work.
    Any pointers?!

    Hi Hans,
    the javax.ejb.CreateException is located in the ejb20.jar
    ...usr\sap\[SID]\JC[InstNo]\cluster\server0\bin\ext\ejb20
    for any kind of class location probs use the classlocator - nice plugin for eclipse and your NWDS
    http://sourceforge.net/projects/classlocator
    Greets Jens

  • Import javax.ejb cannot be resolved

    Hi,
    There are some libraries missing in the following code.
    package era.budget;
    import javax.ejb.*;
    import era.budget.BudgetVO;
    public class BudgetItemVO implements java.io.Serializable
         private Integer itemId;
         private BudgetVO budget;
         private int type;
         private String itemDetails;
         private int amount;
    // -------------- BEGIN GET/SET METHODS --------------
    public BudgetItemVO(Integer id)
              this.itemId = id;
         public BudgetItemVO()
         public Integer getItemId()
              return itemId;
    public BudgetVO getBudget()
              return budget;
         public void setBudget(BudgetVO budget)
              this.budget=budget;
    public int getType()
              return type;
         public void setType(int id)
         this.type=id;
    public String getItemDetails()
              return this.itemDetails;
    public void setItemDetails(String details)
              this.itemDetails=details;
    public int getAmount()
              return this.amount;
    public void setAmount(int amount)
    this.amount=amount;
    As aresult of these missing libraries there are some compilation errors..Some of the errors are as follows
         1)The import javax.ejb cannot be resolved     
         2)EntityBean cannot be resolved to a type     
    3)EntityContext cannot be resolved to a type     
    4)EJBLocalObject cannot be resolved to a type     
    Thanx & Regards
    Maria.

    try: in your project properties choose 'Java Build Path' and add javaee.jar (from J2EE_HOME\lib) as external jar

  • Import from javax.mail cannot be resolved

    Hi,
    After migration from Netweaver 7.0 to 7.1 CE, the import of the package  import javax.mail.*
    The error is javax.mail cannot be resolved.
    Do I have to add special Dependencies to my DC?
    Best regards,
    Peter

    Hi
    Please refer following thread.
    [external jar in CE|import a external jar in web dynpro project;
    [external library insight webdynpro |Problem in Reading Excel File from Webdynpro;
    Best Regards
    Satish Kumar

  • Import javax.persistence cannot be resolved

    I am running Weblogic Workshop 9.2.0 and Eclipse-Helios v3.6.2, and am running both jdk1.6 and jdk1.5. Going through the Java 5 Tutorial on Web Tier technologies, I am experiencing the above error.
    On investigating the jdk, I am unable to find the jar file that contains the above package. Can someone point me in the correct direction to resolve this issue?
    Thank you.
    Stevenson

    The class is not in the JDK, it is part of the JEE5/JEE6 platform and thus provided by weblogic itself. Generally you have a few options;
    - figure out which libraries of weblogic you have to add (the documentation should tell you this)
    - if using an IDE, you can generally setup a server runtime in your project; in doing so the correct libraries are automatically added
    - IDEs generally give access to a generic 'stub' implementation of the JEE classes that you can compile against. You don't need to deploy anything because as said the server already provides the libraries during runtime.

  • The import javax.ejb cannot be resolved

    Hi all,
    I have a bean working fine when deployed as jar on weblogic but it gives the above error when deployed as ear. Deployment goes ok but when I try to use it I get the error.
    Anybody has any idea of what the problem could be?
    Thanks,
    A.

    I figured out that if I include j2ee.jar in the ear file and the entry j2ee.jar in the Class-Path of the manifest file inside the jar then everything works, but I can't understand why...do I ALWAYS need to include j2ee.jar for every aplication that I deploy?
    A.

  • Javax.servlet.*

    Where can I find the jar file so I can use java.servlet.* ?
    I set my CLASSPATH and JAVA_HOME variables... is there anything else i need to do? When I go to compile my code it says javax.servlet cannot be resolved.
    Any help would be great, thanks!

    I put the path to the jar file in my classpath and it
    still doesnt work.How did you do that? If you did it correctly, the JVM will find it. If you did it incorrectly, you'll still have the error.
    >
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class test extends HttpServlet {It looks like its importing javax.servlet.*; and the
    other one just fine, What does "importing fine" look like?
    Do you know what the "import" keyword is really doing for you. (Hint: It has nothing to do with loading classes.)
    but it throws its first error at
    HttpServlet saying that it cannot be resolved to a
    type. You haven't added the JAR to the CLASSPATH properly then. More details, please. What container are you using? Tomcat? If so, you need to look for /common/lib/servlet-api.jar and get that into your CLASSPATH.
    This has been holding me up all day.There's no way something like this should be holding you up for a day. Ask somebody in your area that knows Java and CLASSPATH.
    %

  • Cannot find package javax.servlet.*

    Hi All,
    I'm trying to run the "make all" in the Wrox J2ee bea book and am running in to errors that all seem to stem from the fact that the javax.servlet.* packages do not exist. After looking around it seems that this package should be in the weblogicaux.jar file. I do not have that jar file in my install. Anyone know where i can either get that weblogicaux.jar file or any file which has the javax.servlet packages. Any help would be much appreciated.
    Hoony
    weblogic 5.1.0

    That jar file should be located in %WebLogichome%\lib.
    Michael Girdley
    BEA Systems
    Learning WebLogic? http://learnweblogic.com
    "Hoony Youn" <[email protected]> wrote in message
    news:3a70280f$[email protected]..
    >
    Hi All,
    I'm trying to run the "make all" in the Wrox J2ee bea book and am runningin to errors that all seem to stem from the fact that the javax.servlet.*
    packages do not exist. After looking around it seems that this package
    should be in the weblogicaux.jar file. I do not have that jar file in my
    install. Anyone know where i can either get that weblogicaux.jar file or
    any file which has the javax.servlet packages. Any help would be much
    appreciated.
    >
    Hoony
    weblogic 5.1.0

  • EJB and JMs cannot be resolved

    hello,
    I was running an example of message bean driven and it worked.
    I am on Windows XP, j2sdk 1.4.1_02, and jonas 3.1 and eclipse 2.1. all my classpath seem to be set correctly.
    I use a ant script to compile it but when I run on the concole this is the same error.
    But today nothing works when I am compiling the code I 've got the following error:
    [javac] ----------
    [javac] 1. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 34)
    [javac] import javax.ejb.MessageDrivenBean;
    [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.ejb cannot be resolved
    [javac] ----------
    [javac] 2. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 35)
    [javac] import javax.ejb.MessageDrivenContext;
    [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.ejb cannot be resolved
    [javac] ----------
    [javac] 3. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 36)
    [javac] import javax.jms.JMSException;
    [javac] ^^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 4. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 37)
    [javac] import javax.jms.Message;
    [javac] ^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 5. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 38)
    [javac] import javax.jms.MessageListener;
    [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 6. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 39)
    [javac] import javax.jms.TextMessage;
    [javac] ^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 7. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 49)
    [javac] public class MdbBean implements MessageDrivenBean, MessageListener {
    [javac] ^^^^^^^^^^^^^^^^^
    [javac] MessageDrivenBean cannot be resolved or is not a valid superinterface
    [javac] ----------
    [javac] 8. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 49)
    [javac] public class MdbBean implements MessageDrivenBean, MessageListener {
    [javac] ^^^^^^^^^^^^^^^
    [javac] MessageListener cannot be resolved or is not a valid superinterface
    [javac] ----------
    [javac] 9. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 51)
    [javac] private transient MessageDrivenContext mdbContext;
    [javac] ^^^^^^^^^^^^^^^^^^^^
    [javac] MessageDrivenContext cannot be resolved (or is not a valid type) for the field MdbBean.mdbContext
    [javac] ----------
    [javac] 10. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 78)
    [javac] public void setMessageDrivenContext(MessageDrivenContext ctx) {
    [javac] ^^^^^^^^^^^^^^^^^^^^
    [javac] MessageDrivenContext cannot be resolved (or is not a valid type) for the argument ctx of the method setMessageDrivenContext
    [javac] ----------
    [javac] 11. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 80)
    [javac] mdbContext = ctx;
    [javac] ^^^^^^^^^^
    [javac] mdbContext cannot be resolved
    [javac] ----------
    [javac] 12. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 107)
    [javac] public void onMessage(Message message) {
    [javac] ^^^^^^^
    [javac] Message cannot be resolved (or is not a valid type) for the argument message of the method onMessage
    [javac] ----------
    [javac] 13. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 110)
    [javac] TextMessage mess = (TextMessage)message;
    [javac] ^^^^^^^^^^^
    [javac] TextMessage cannot be resolved or is not a type
    [javac] ----------
    [javac] 14. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 110)
    [javac] TextMessage mess = (TextMessage)message;
    [javac] ^^^^^^^^^^^
    [javac] TextMessage cannot be resolved or is not a type
    [javac] ----------
    [javac] 15. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbBean.java (at line 112)
    [javac] }catch(JMSException ex){
    [javac] ^^^^^^^^^^^^
    [javac] JMSException cannot be resolved or is not a type
    [javac] ----------
    [javac] ----------
    [javac] 16. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 34)
    [javac] import javax.jms.Session;
    [javac] ^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 17. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 35)
    [javac] import javax.jms.TextMessage;
    [javac] ^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 18. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 36)
    [javac] import javax.jms.Topic;
    [javac] ^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 19. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 37)
    [javac] import javax.jms.TopicConnection;
    [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 20. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 38)
    [javac] import javax.jms.TopicConnectionFactory;
    [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 21. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 39)
    [javac] import javax.jms.TopicPublisher;
    [javac] ^^^^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 22. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 40)
    [javac] import javax.jms.TopicSession;
    [javac] ^^^^^^^^^^^^^^^^^^^^^^
    [javac] The import javax.jms cannot be resolved
    [javac] ----------
    [javac] 23. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 53)
    [javac] static TopicConnectionFactory tcf = null;
    [javac] ^^^^^^^^^^^^^^^^^^^^^^
    [javac] TopicConnectionFactory cannot be resolved (or is not a valid type) for the field MdbClient.tcf
    [javac] ----------
    [javac] 24. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 54)
    [javac] static TopicPublisher tp = null;
    [javac] ^^^^^^^^^^^^^^
    [javac] TopicPublisher cannot be resolved (or is not a valid type) for the field MdbClient.tp
    [javac] ----------
    [javac] 25. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 55)
    [javac] static Topic topic = null;
    [javac] ^^^^^
    [javac] Topic cannot be resolved (or is not a valid type) for the field MdbClient.topic
    [javac] ----------
    [javac] 26. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 66)
    [javac] tcf = (TopicConnectionFactory) ictx.lookup(conFactName );
    [javac] ^^^
    [javac] tcf cannot be resolved
    [javac] ----------
    [javac] 27. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 66)
    [javac] tcf = (TopicConnectionFactory) ictx.lookup(conFactName );
    [javac] ^^^^^^^^^^^^^^^^^^^^^^
    [javac] TopicConnectionFactory cannot be resolved or is not a type
    [javac] ----------
    [javac] 28. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 67)
    [javac] System.out.println("JMS client: tcf = " + tcf.toString());
    [javac] ^^^
    [javac] tcf cannot be resolved
    [javac] ----------
    [javac] 29. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 69)
    [javac] topic = (Topic) ictx.lookup(topicName);
    [javac] ^^^^^
    [javac] topic cannot be resolved
    [javac] ----------
    [javac] 30. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 69)
    [javac] topic = (Topic) ictx.lookup(topicName);
    [javac] ^^^^^
    [javac] Topic cannot be resolved or is not a type
    [javac] ----------
    [javac] 31. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 75)
    [javac] TopicConnection tc = null;
    [javac] ^^^^^^^^^^^^^^^
    [javac] TopicConnection cannot be resolved or is not a type
    [javac] ----------
    [javac] 32. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 76)
    [javac] TopicSession session = null;
    [javac] ^^^^^^^^^^^^
    [javac] TopicSession cannot be resolved or is not a type
    [javac] ----------
    [javac] 33. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 78)
    [javac] tc = tcf.createTopicConnection();
    [javac] ^^^
    [javac] tcf cannot be resolved
    [javac] ----------
    [javac] 34. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 80)
    [javac] session = tc.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
    [javac] ^^^^^^^^^^^^^^^^^^^^^^^^
    [javac] Session cannot be resolved
    [javac] ----------
    [javac] 35. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 81)
    [javac] tp = session.createPublisher(topic);
    [javac] ^^
    [javac] tp cannot be resolved
    [javac] ----------
    [javac] 36. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 81)
    [javac] tp = session.createPublisher(topic);
    [javac] ^^^^^
    [javac] topic cannot be resolved
    [javac] ----------
    [javac] 37. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 90)
    [javac] TextMessage message;
    [javac] ^^^^^^^^^^^
    [javac] TextMessage cannot be resolved or is not a type
    [javac] ----------
    [javac] 38. ERROR in C:\Java\Workspace\MDBTest\com\iratensolutions\test\MdbClient.java (at line 94)
    [javac] tp.publish(message);
    [javac] ^^
    [javac] tp cannot be resolved
    [javac] ----------
    [javac] 38 problems (38 errors)
    [javac] BUILD FAILED: file:C:/Java/Workspace/MDBTest/com/iratensolutions/test/build.xml:107: Compile failed; see the compiler error output for details.
    Total time: 610 milliseconds
    Thank you for your help

    Hi,
    You need to place ejb.jar and jms.jar present in
    <jonAs-home>\lib\common\j2ee directory in the classpath.
    -Amol

  • Javax.servlet.ServletContext cannot be resolved in Tomcat 5.5.12

    I deployed my web application in Tomcat 5.5.12 (Solaris 10 platform), and found following error message:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 16 in the jsp file: /countrydetail.jsp
    Generated servlet error:
    javax.servlet.ServletContext cannot be resolved
    An error occurred at line: 16 in the jsp file: /countrydetail.jsp
    Generated servlet error:
    ctx cannot be resolved
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.12 logs.
    Apache Tomcat/5.5.12
    The application was developed by NetBeans 5 RC2 and runed well under Windows platform.
    The error appears when I click link . At first I thought it may be caused by JSF, but I tested the sample JSF web with simliar link, and there is no problem.
    I do saw servlet-api.jar (which contains javax.servlet.ServeletContext) in Tomcat common/lib. Why tomcat can not locate the class?

    I solved this problem by deploying the application in Tomcat 5.5.15. It seems that the problem in above post is a bug in Tomcat 5.5.12.
    Details please refer to http://issues.apache.org/bugzilla/show_bug.cgi?id=38211

  • Package javax.servlet does not exists - Cannot resolve symbol

    Hello,
    I am using JDK 1.3.1.06 version. I wanted to compile a simple servlet using this. But I am getting plenty of errors for all javax package. Why it is not able to find javax package classes?
    The following is the program I have tried to compile.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class TestServlet extends HttpServlet
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    process(request, response);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    process(request, response);
    private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    PrintWriter out = response.getWriter();
    out.println("Hello World !");
    I am getting errors like this :
    Package javax.servlet does not exists.
    cannot resolve symbol
    symbol : class HttpServlet
    Please advice me some solutions fast.
    Thanking you,
    ForumAns.

    javax.servlet doesn't come with the standard jdk. It's part of J2EE.
    If you have tomcat, you can use the server.jar that comes with tomcat.
    Or you can just download J2EE sdk instead.
    I am getting errors like this :
    Package javax.servlet does not exists.
    cannot resolve symbol
    symbol : class HttpServlet

  • Javax.servlet.ServletContext cannot be resolved in Eclipse

    I am loading my project in Eclipse, I am getting this error :
    The type[b] javax.servlet.ServletContext cannot be resolved. It is indirectly referenced from required .class files
    I have set all the libraries, how can make eclipse avaliable with this class

    Which libraries have you set?
    javax.servlet.ServletContext would be in the J2EE servlet API.
    In tomcat this is [TOMCAT]/common/lib/servlet-api.jar
    In other containers it might be j2ee.jar

  • Cannot fing the javax.servlet.*; package

    Hi everybody.. I am new to J2EE Programming.. I just wrote a very small and simple Servlet to see how it works.. The Servlet is designed to take in the the name and a favourite color of a user via a HTML page and display it to him
    Here is the code:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class VerifyData extends HttpServlet
         public void doGet (HttpServletRequest reg, HttpServletResponse res) throws ServletException, IOException
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              String name= req.getParameter ("name");
              String color=req.getParameter ("color");
              out.println("<html>");
              out.println("<head>");
              out.println("<title>Simple HTML Form</title>");
              out.println("<link rel='styleSheet' type='text/css' href='examples.css'>");
              out.println("</head>");
              out.println("<body>");
              out.println("<h1>Hello "+name+" Your favourite Color is : " +color+"</h1>");
              out.println("<form method='GET' action='verifydata'>");
              out.println("<p>Please Type in your name here:</p>");
              out.println("<input type='text' name='name'>");
              out.println("<p>Now select the color of your choice</p>");
              out.println("<select name='color' size='1'>");
              out.println("<option>red<option>green<option>blue</select>");
              out.println("<br></br>");
              out.println("<input type='submit'>");
              out.println("<br></br>");
              out.println("<table>");
              out.println("<tr><th>Colors</th><th>Description</th></tr>");
              out.println("<tr><td>Red</td><td>Blood</td></tr>");
              out.println("<tr><td>Green</td><td>Grass</td></tr>");
              out.println("<tr><td>Blue</td><td>Sky</td></tr>");
              out.println("</table>");
              out.println("</form>");
              out.println("</body>");
              out.println("</html>");
    }BUT I got the following Error:
    C:\Sun\AppServer\jdk\bin>javac VerifyData.java
    VerifyData.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    VerifyData.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    VerifyData.java:5: cannot find symbol
    symbol: class HttpServlet
    public class VerifyData extends HttpServlet
                                    ^
    VerifyData.java:7: cannot find symbol
    symbol  : class HttpServletRequest
    location: class VerifyData
            public void doGet (HttpServletRequest reg, HttpServletResponse res) thro
    ws ServletException, IOException
                               ^
    VerifyData.java:7: cannot find symbol
    symbol  : class HttpServletResponse
    location: class VerifyData
            public void doGet (HttpServletRequest reg, HttpServletResponse res) thro
    ws ServletException, IOException
                                                       ^
    VerifyData.java:7: cannot find symbol
    symbol  : class ServletException
    location: class VerifyData
            public void doGet (HttpServletRequest reg, HttpServletResponse res) thro
    ws ServletException, IOException
       ^
    VerifyData.java:11: cannot find symbol
    symbol  : variable req
    location: class VerifyData
                    String name= req.getParameter ("name");
                                 ^
    VerifyData.java:12: cannot find symbol
    symbol  : variable req
    location: class VerifyData
                    String color=req.getParameter ("color");
                                 ^
    8 errors
    C:\Sun\AppServer\jdk\bin>Please please please help me out. I am not sure about the class path settings etc.. but its like this C:\Sun\AppServer\jdk\lib\tools.jar

    Hi everybody
    I am new to j2ee.I am using java ee5.Application server as apache-tomcat-5.5.17.I tried to compile servlet using javac.it gives the following errors.
    HelloServlet2.java:4: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    HelloServlet2.java:5: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    HelloServlet2.java:15: cannot find symbol
    symbol: class HttpServlet
    public class HelloServlet2 extends HttpServlet {
    ^
    HelloServlet2.java:16: cannot find symbol
    symbol : class HttpServletRequest
    location: class coreservlets.HelloServlet2
    public void doGet(HttpServletRequest request,
    ^
    HelloServlet2.java:17: cannot find symbol
    symbol : class HttpServletResponse
    location: class coreservlets.HelloServlet2
    HttpServletResponse response)
    ^
    HelloServlet2.java:18: cannot find symbol
    symbol : class ServletException
    location: class coreservlets.HelloServlet2
    throws ServletException, IOException {
    ^
    6 errors
    this is the code
    public class HelloServlet extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String docType =
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
    "Transitional//EN\">\n";
    out.println(docType +
    "<HTML>\n" +
    "<HEAD><TITLE>Hello (2)</TITLE></HEAD>\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1>Hello (2)</H1>\n" +
    "</BODY></HTML>");
    pls help me to resolve this problem.
    Thank you
    sam

Maybe you are looking for