How to install servlet classes in order to compile a simple servlet...

When trying to compile a simple servlet (java file), I get errors having to do with not finding any object of the javax.servlet class. I am using J2SE v.1.4, and from what I know, it does not have built-in support for Servlets-JSP.
Do I need to install myself the servlet classes (downloaded from Sun's site) in order for my servlet to be able to compile and work under tomcat? And if so, where should I put them? Or is there something else I have to do?
Thank you in advance for your assistance!

If you have Tomcat already, the files you require are in:
(Tomcat4)
[TOMCAT_HOME]/common/lib/servlet.jar
or
(Tomcat5)
[TOMCAT_HOME]/common/lib/servlet-api.jar
[TOMCAT_HOME]/common/lib/jsp-api.jar
This file needs to be added to your classpath when compiling a servlet.

Similar Messages

  • Servlet - unable to compile my simple servlet

    I downdloaded the servlet api, I changed the classpath to point to the directory that I extracted to. However, I still cannot compile a simple servlet. I am sure I did not install the servlet api the right way. Can somebody help?
    Thanks

    This may sound silly, but you did UNZIP the servlet API, right?
    Where did you set the classpath? Through an environment variable? Through a command line?
    Best,
    brumalis

  • How to install Application in specific order

    We are running SCCM 2012 R2 Primary Site Server. We are using Application Management to install applications.
    We have following requirements:
    If we have tow applications A,B and packaged using MSI, how do we set up the order of installation so that when advertised:
    1. If user clicks on A, B gets installed automatically.
    2. if user clicks on B, A gets installed first and then B gets installed.
    We have been able to achieve part 2 using dependencies. However how to get the part 1 to work.
    Many thanks!!!

    Hi,
    If you create a dependency for app A to install App B then you cannot have a dependency for App B to install App A, that would create a loop.
    I would either just deploy one of the apps and use dependencies and inform the users to install App A to get B as well or group them together in a Wrapper that runs both installations when you install the application as that is what you want in this scenario.
    Regards,
    Jörgen
    -- My System Center blog ccmexec.com -- Twitter
    @ccmexec

  • How to instal/set UWL in order to test WF functionality also on test system

    I am replacing colleague who is on hollydays.
    I am pritty new in EP area. We have integrated ESS functionality with some approval workflows.
    WF guy told me I have to maintain the UWL on test system as this one can not communicate with test backend system.
    So far I created iviews with SAP transactions(and one with URL), page workset and a test role on an brand new system enironment consisting of an ides ecc on an freshly installed  EP system.
    On old  test EP I am very confused (maybe because of  ESS package). Other confusing thing is that on this EP system I can not add e.g an i.view(there  I can not  as "No templates to display. You are not assigned to any existing templates.").
    So my question would be :
    1.How to instal/set UWL (so that workflows can be tested on test environment i.e. old test system with ESS package  in connection with backend
    2.How could I get reed of "No templates to display. You are not assigned to any existing templates." message(espetially if this has any impact on qustion 1.)
    Thank you in advance for your imout

    few settings in java were wrong

  • How to install eclipse and MyEclipse and use it for jsp-servlet-web service

    hi ,
    please help me to install eclipse 3.1 and How to integrate MyEclipse to do jsp-servlet programming and web services.
    please also help me to include application server like tomcat and axis and use that environment in MyEclipse ide.
    please help me.....

    At the time of installation , you can't change SID XE.
    After installation, you can add another service name
    Check following thread for more details
    Re: How to create service on Oracle 10g XE
    - Virag Sharma
    http://virag.sharma.googlepages.com
    http://viragsharma.blogspot.com

  • How to modify a class in .jar and compile it back

    Hi,
    I have questions reg .jar, I need to test my application and I need to modify certain files in that .jar and compile it back. How do I do that? I have extract all the classes and decompile it to .java, and I just want to edit just 1 file, but I always have problems compiling it. Am i doing it the wrong way?Please help...
    Thanks.

    Did you make a jar and now need to make changes? Help me to understand why you decomplied the class files? Can you not just make a new jar?

  • Where is the oracle.jdeveloper.servlet  Class?

    Hi,
    I want to use a dbservlet in Oracle JDeveloper 3.2 or higher but I can not find dbservlet class/icon to create a dbservlet with a wizard. How I install this class and where can I download this? What is to do to use this classes in JDeveloper.
    Thank´s
    Sebastian

    The dbServlet functionalit has been replaced by the use of JSP pages + DataTags.

  • Retrieve ServletContext from non-servlet class

    A servlet calls a method which is located in another class which is not a servlet. Within this method of the non-servlet class, i need to access the ServletContext of the servlet that has called the method. What i am currently doing is simply passing the ServletContext as a parameter to the method.
    I would like to avoid passing the ServletContext all the time, so i'm wondering if it's possible, from the non-servlet class, to retrieve the ServletContext of the servlet which has called the method of the non-servlet class.

    Thanks J-Fine, that's a smart suggestion. BTW in the meantime i figured out that passing the ServletContext is not that bad idea, after all it reflects the structure of the app. However if i'll change my mind again i'll do like you suggested.

  • Servlet class creating multiple objects

    Hi
    I am using WSAD 5.0. My servlet is acting as a controller but when when i m invoking the servlet from 2 JSPs , server is creating 2 objects for that servlet because of which i m not able to get the values which was set by the first servlet object..
    Can somebody tell me why the server is creating 2 objects for my servlet.
    Alok

    No.. its is invoked only once.
    If an instance of the servlet does not exist, the Web container
    Loads the servlet class.
    Creates an instance of the servlet class.
    Initializes the servlet instance by calling the init method. Initialization is covered in Initializing a Servlet.
    Invokes the service method, passing a request and response object. Service methods are discussed in the section Writing Service Methods.
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets4.html
    MeTitus

  • Compile error for servlets

    Hi
    I have recently downloaded jakarta-tomcat3.3a and i'm trying to compile my simple servlets,but i have an error saying the
    "import javax.servlet.*" not found and many more.
    It seems to me that i'm missing servlet.jar file.
    Now how do i set this.I'm sure it should be in classpath but i need to know where will i create my CLASSPATH variable,i mean to say is it in user variable or system variable.
    I have already set my PATH in <control panel><system>environmental variable>USer variable>.
    But i have not set any classpath till now as it was not necessary for me to run my java programs.
    But now i think i have set the CLASSPATH.
    I have my tomcat in C:\jakarta-tomcat-3.3a
    Can anyone give me the exact path to set.
    Thanks in advance.

    The difference between System and User environment variables are simply who has access to them. When you set a System EV, it will persist regardless of the logged in user. User variables are specific only to that user. Which one you decide to set depends on which you really want.. but i believe User variables will override System variables.
    Your classpath should then include..
    c:\tomcat_install_dir\lib\servlet.jar

  • How to install servlet-2_3-fcs-classfiles.zip???

    Hi!
    I am using jdk1.3.1_02 and I try to compile a servlet source code. But I got error message
    C:\tomcat\webapps\examples\WEB-INF\classes\HelloWorldExample.java:8: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    I already unzip the contents of servlet-2_3-fcs-classfiles.zip in my jdk1.3.1_02 directory, but still it doesn't work. Anyone any ideas how to install it properly?

    When you unzip the servlet, there should be a folder named javax, you can either move that folder to C:\jdk1.3.1_02 and compile the program normally (assuming that you have already defined a ckasspath that contains C:\jdk1.3.1_02). Or, you can add the path to your javax folder to the CLASSPATH environment variable.
    V.V.

  • How can i make a servlet (class) temporarily unavailable, except for ADMIN

    Hello All!
    I am rather new to the programming field and have already completed a web-project in Java only with Servlets. (no jsp). I have a login procedure, means I have a user management for users and admins. If an admin is logged in, he/she should be able to deactivate the servlet with a mouse-click as long he activates it again with the same. if the servlet is deactivated, other users/admins trying to access the servlet should get a "servlet is currently unavailable" message. but the admin, who is logged in, still should be able to work with the servlet! how can i realise that?
    in other words, by clicking that particular button, the servlet should be made "non-multi-thread" and other way round by activating it.
    any ideas??? how can the standard "servlet currently unavailable" page be displayed? I have tomcat 4 on a linux machine! i'd be really grateful if someone oculd help me.
    another question i have is, how to define a "pseudo" link address to the servlet. now, the servlet can only be accessed by typing like this: http://servername.xy.com:8080/ProjectName/servlet/ServletName (because I have activated the servlet mapping in the server.xml/web.xml with /servlet/*)
    but I want a link like this: http://servername.xy.com:8080/shortname
    How can I do this in an easy way?? I have treid to create a web.xml in der WEB-INF folder of the servlet with following content, but it is not working:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>
    shortname
    </servlet-name>
    <servlet-class>
    ClassName
    </servlet-class>
    </servlet>
    </web-app>
    Thanks a lot in advance for your kind help,
    lisa

    Ok,
    You'll need to find a tutorial on servlet filters. Its not that hard a concept.
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Servlets8.html#wp64572
    Filters need to be configured in the web.xml.
    Basically they are a buffer between a request and your servlet.
    Any requests for the servlet, go through the filter first. It lets you do some processing before/after the servlet gets called. Its a good way of putting in some generic code that need to be run for many servlets - security checks are often implemented in this fashion.
    This should give you an idea of the sort of thing you need. I haven't really written one before, so I copied this out of the tutorial and did some basic framework for it....
    public final class TestFilter implements Filter {
       private FilterConfig filterConfig = null;
       public void init(FilterConfig filterConfig) throws ServletException {
          this.filterConfig = filterConfig;
       public void destroy() {
          this.filterConfig = null;
       public void doFilter(ServletRequest request,  ServletResponse response, FilterChain chain) throws IOException, ServletException {
            // if you want to get the session will need to cast request to an HttpServletRequest
            Session session = request.getSession();
            String requestURL = request.getRequestURL();
            // check if this URL is for a servlet that is disabled for this user
           // somehow you have to keep track of this ... maybe in the servletContext ?
        User user = (User) session.getAttribute("user")     
          boolean disabled = checkDisabled(requestURL, user);
          // if its not disabled, go ahead
          if (!disabled)
            chain.doFilter(request, response);
        else{
            // send the servlet off somewhere else - requestDispatcher maybe?
    }

  • How to install oracle xsql servlet on bea weblogic 5.1

              Hi there,
              I tried to install oracles xsql servlet (1.0.4.1) on bea weblogic 5.1 without
              any success.
              in weblogic.properties I started with:
              weblogic.httpd.webApp.xsql=c:\\weblogic\\myserver\\servletclasses\\xsql
              And in this dir I have WEB-INF with the following web.xml:
              <?xml version="1.0" encoding="ISO-8859-1"?>
              <!DOCTYPE web-app
              PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
              "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
              <web-app>
              <servlet>
              <servlet-name>oracle-xsql-servlet</servlet-name>
              <servlet-class>oracle.xml.xsql.XSQLServlet</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>oracle-xsql-servlet</servlet-name>
              <url-pattern> *.xsql </url-pattern>
              </servlet-mapping>
              </web-app>
              So the xsql extension is mapped to the named servlet which is found in a jar file
              contained in subdirectory lib.
              The problem is that the general mapping of *.xsql extension to specified class
              does not work at all. And there are no errors...
              Application server just presents me with the content of the xsql file instead
              of executing servlet whith the xsql file as input.
              Any ideas??
              Thanx in advance.
              JK
              

    What kind of problem do you have?
    If it's not connected with JDBC, you'd better post your question
    in webservices newsgroup.
    Regards,
    Slava Imeshev
    "leopld goess" <[email protected]> wrote in message
    news:[email protected]..
    hy out there.
    i've been working with apache soap on wl 5.1 for a while now, and
    everything seems to be working allright- as long as i don't try to
    install a servicepack, namely sp8 or sp10. if i do that, the entire
    soap service fails to deploy.
    any ideas...
    thanx
    leopold

  • How to publish a servlet class to web server?

    background:
    web server: tomcat apache 4
    context path: webapp\test\
    servlet path: webapp\test\WEB-INF
    servlet name: HelloWorld.class
    i tried to placed the servlet class file to above servlet path,
    but i can't invoke the servlet by http://localhost:8080/test/HelloWorld
    what should i do in order to invoke the servlet at browser?
    Is a web.xml necessary a must to provided a mapping between request name and actual class name?

    First of all you need a *.war structure which look like this
    /app-name
    /app-name/WEB-INF/
    /app-name/WEB-INF/lib
    /app-name/WEB-INF/classes
    When you have created this structure you add your servlet (HelloWorld.class) in the classes directory (Create the package structure first).
    When this is done you need to map the servlet to a given uri which is done in the web.xml. An example is found below:
    <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>package.HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello/*</url-pattern>
    </servlet-mapping>
    Hopefully this will help :-)
    best regards
    Stig

  • How to access an external text file in a Servlet class?

    I do the regular file I/O in the Servlet class. But when I run Servlet class, text file is not loaded. Can sb tell me how to do it?
    Thanx
    Richard

    Hi DrClap;
    the following is the main servlet code, which calls other two classes.
    ===================================================================
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class TermsServlet extends HttpServlet {
              public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
              resp.setContentType("text/html");
              PrintWriter out = resp.getWriter();
              out.println("<HTML>");
              out.println("<TITLE>Computer Terms and Acronyms</TITLE>");
              out.println("<BODY>");
              out.println("<H1>Computer Terms and Acronyms</H1>");
              out.println("<TABLE BORDER=2>");
              out.println("<TR><TH>Term<TH>Meaning</TR>");
              TermsAccessor tax = new TermsAccessor("terms.txt");
              Iterator e = tax.iterator();
              while (e.hasNext()) {
                   Term t = (Term)e.next();
                   out.print("<TR><TD>");
                   out.print(t.term);
                   out.print("<TD>");
                   out.print(t.definition);
                   out.println("</TR>");
              out.println("</TABLE>");
              out.println("<HR></HR>");
              out.println("</BODY></HTML>");
    =================================================
    import java.io.*;
    import java.util.*;
    public class TermsAccessor {
         protected BufferedReader is;
         protected String ident;
         public TermsAccessor(String inputFileName) throws IOException {
              is = new BufferedReader(new FileReader(inputFileName));
              String ident = is.readLine();
         public String getIdent() {
              return ident;
         public Iterator iterator() {
         return new Iterator() {
              String line, term, defn;
    public boolean hasNext() {
              try {
              return ((line = is.readLine()) != null);
              } catch (IOException e) {
              System.err.println("IO Error: " + e);
              return false;
              public Object next() {
              int i;
              while ((i = line.indexOf("\t"))<0 && hasNext());
              if (line == null)
              throw new IllegalStateException("Invalid EOF state");
                        term = line.substring(0, i);
                        defn = line.substring(i+1);
                        return new Term(term, defn);
              public void remove() {
              throw new UnsupportedOperationException();
    =============================================================
    public class Term {
              public String term;
              public String definition;
              public Term(String t, String d) {
              term = t;
              definition = d;
    =================================================================
    part of [terms.txt] file as following:
    $Id: terms.txt,v 1.5 2000/03/17 04:08:55 $
    AMD     American Micro Devices: a chip maker that competes with Intel.
    API     Application Programmer Interface: a set of functions that a programmer can use
    ASP     Active Server Pages, a Microsoft technology for imbedding certain commands in HTML pages
    BSD     Berkeley Software Distribution, one of the two major flavors of UNIX. See OpenBSD
    C     A computer programming language invented for writing UNIX in, and very popular in the late 1970's through the 1990's
    C++     An Object-Oriented language heavily based on C; recently displaced by Java
    CGI     Common Gateway Interface; a script or program used to handle a form on a web page
    COBOL     COmmon Business Oriented Language, a programming language used mainly for large-scale financial applications.
    CPU     Central Processing Unit, the "chip" that gives a computer its low-level personality ("machine instruction set") and performs individual instructions (add, multiply, compare...). Common CPUs include Intel/AMD "PC", SPARC, Alpha.
    =================================================================
    the "terms.txt" file and above class files are under the same directory. I use J2EE server to deploy the file, after run, the erro mesage is:"The requested resource (terms.txt (The system cannot find the file specified)) is not available." That means server can not locate the terms.txt file. So what file path should I use?
    Thanx
    Richard

Maybe you are looking for

  • Self registered Bidders to be transferred to ECC

    Hello All, Wondering if anybody has mapped this or has any clue. First our landscape for ready ref. SAP_ABA     700     0011     SAPKA70011     Cross-Application Component SAP_BASIS     700     0011     SAPKB70011     SAP Basis Component PI_BASIS    

  • Integration Directory objects

    Hi experts, I have a sender systems which sends a file to three webservices,i.e file-webservice scenario using BPM,but here need to send to 3 webservices of a 3rd party systems in sequence.Can you tell me how many sender agreements,receiver agreement

  • Error 1714. Error 1603. could not upgrade itunes

    when i tried upgrading to iTunes 6, i got the following errorr. Error 1714: Older version could not be uninstalled. Then i got another, Error 1603, saying itunes.msi was not found or something like that. what must be done? I use a iPod Shuffle.

  • Need to reinstall FC Studio?

    I had to re install Tiger because of some read/write issues discovered during a tech tools scan. I didi "archive and install" and most things are ok. FCP and Compressor and soundtrack pro and motion will not open. FCE, DVDSP4, live type and soundtrac

  • Want to Switch from In Store Pick up to Delivery

    I already "preordered" an iphone 3G S for in store pick up earlier this week. Now of course, they are offering delivery to my door, and a guaranteed iphone in my pocket by June 19. Would there be an issue or weird overlap if I just pleasantly ignore