How do we run a servlet program in eclipse

how do we run a servlet program in eclipse.

Not at all, because servlets require a servlet container. Some Eclipse plugins (Lomboz etc.) do provide integration with those.

Similar Messages

  • Error while running a Servlet program in Eclipse IDE

    Hi,
    I have tried running the following program in the Eclipse Editor. It doesnt compile. I have installed the Tomcat plugin too.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class HTTPGetServlet extends HttpServlet {
         public void doGet(HttpServletRequest request,
                   HttpServletResponse response)
         throws ServletException, IOException
              PrintWriter output;
              response.setContentTe("text/html");
              output=response.getWriter();
              StringBufer buf=new StringBuffer();
              buf.append("<HTML><HEAD><TITLE>\n");
              buf.append("A simple servlet example\n");
              buf.append("</TITLE></HEAD><BODY>");
              buf.append("<H1>Welcome to the world</H1>\n");
              buf.append("</BODY></HTML>");
              out.println(buf.toString());
              output.close();
    On a closer look i realized that the IDE is showing as error any import statements i type in. Can anyone help me get over this problem? Thanks a lot in advance.
    bye
    V

    You need to add the JAR containing the servlet API in the external JARs for the project.
    Regards,
    Carol.

  • How to run servlet program in eclipse 3.1

    i run the jsp program in eclipse 3.1
    i want to run sample servlet program in eclipse, how to create the project,where to store the class file..? where to store the web.xml file..?
    plz give explanation with HelloWorld.java program....

    Install WTP and follow the basic J2EE WebApp Tutorial from their WTP tutorials page.

  • How to configure a servlet program using Eclipse?

    Hi,
    Am just learning Java and J2ee..Am not efficient..Don't laugh @ my question..
    I installed jdk 1.6, Apache tomcat 5.0 and eclipse 3.2.1 and also installed wtp plugin to work with j2ee perspective of eclipse..I did this in my PC..could U plz tell me what I need to install in addition?
    How come I write my Servlet program using Eclipse...
    Thanq
    Vani.

    This is the Sun Java System Messaging Server forum. Though this application software bears Java in it's name it has nothing to do with the programming language Java.

  • How to run the Servlet program?

    hi, all, I am new to servlet, and I want to know how to run the servlet program. I got the TomCat and Java JDK install in my computer, something else I need for create and run the servlet program?

    no that is all u need to run servlets. u can try few of the servlets that come with tomcat

  • How do i run a servlet??????

    running servlets:i downloaded jsdk but how do i run a servlet? i got the error
    C:\WINDOWS\Desktop>javac HTTPGetServlet.java
    Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/M
    ain
    when i tried to run my servlet, please help
    thanks

    As mentioned in another post in the thread, servlets run from within a web server that has pre-loaded the jvm and serves web requests. Often they are called 'sevlet containers' as they act like a wrapper program for the actual vm. Tomcat is such a web server, quite a popular one for running servlets, and is considered the reference implementation for a sevlet/jsp server. you can read up on it at...
    http://jakarta.apache.org/tomcat/index.html
    To get you started, this is what i did to set up tomcat. Im using RedHat Linux at home, so this may differ to what you have to do initially.
    First, make sure you have at least the jsdk and jsdk ee installed and the appropiate JAVA_HOME and J2EE_HOME environment variables set.
    I am using the Apache web server to handle web page requests on my box. If the request is for a context containing a servlet or jsp file (context is a tomcat term for a particular location or path in the url) then apache passes the request to tomcat via a apache module and a special protocol. Tomcat then runs the .class file or .jsp file, returns the output to apache which then returns the output back to the browser. So initially you should set up and have the apache web server running.
    Next download and install the jserv or tomcat module for apache, which apache uses to communicate with tomcat via a special protocol, and the tomcat rpms from...
    http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.3/rpms/
    ...Im using 3.2.3 which works fine. you may try the later versions if you like.
    Install the tomcat rpms. They should dump a whole lot of stuff in a /var/tomcat directry, including some nice sample and admin apps. if you had downloaded and installed the tomcat-manuals rpm you can find lots of helpful information in the /usr/doc/tomcat-{your version here}/ directry. This is what you should probably read through now!
    Once that is done, its simply a matter of adding a reference in your httpd.conf file to the tomcat.conf file in the tomcat/conf dir (if you want to have complete control over the tomcat module and contexts) or tomcat-apache.conf (in the same directry) if youd like tomcat to handel its own configuration of apache. something like...
    include /var/tomcat/conf/tomcat.conf
    ...should do.
    then run tomcat start (in /usr/bin/) and apache and away you go. You should be able to point your browser to your.server.com/admin/ and get the tomcat admin tools. This allows you to add view and delete contexts to your server (say for separating different server-side applications). your.server.com/examples/ has some nice stuff as well.
    Hope this helps. I warn you im not an expert and haven't looked at this stuff for some time. I probably have something wrong so please, experts, if you see something stuffed up let us know.

  • How can I run a servlet with Sun Java System Application Server PE 8?

    I've created a package with a TestServlet.class inside, used the deploytool to create a WAR and deployed this using the autodeploy folder.
    The filestructure has been generated and I find the TestServlet.class in
    [installdir]\domains\domain1\applications\j2ee-modules\testProject\WEB-INF\classes\[packagefolderstructure]\TestServlet.class.
    The context root is working fine, but I have no clue how I can run the servlet directly via the URL.
    I've tried many things like
    http://localhost:8080/testProject/TestServlet
    http://localhost:8080/testProject/servlet/TestServlet
    http://localhost:8080/testProject/servlet/[packagenamewithpoints]TestServlet
    http://localhost:8080/testProject/servlet/[packagenamewithslashes]TestServlet
    etc etc
    Can somebody tell me please how to write URLs to deployed servlets? Or send me an example url and xml descriptor files?
    Thanks a lot in advance!

    in web.xml use servlet mapping
    <servlet-mapping>
        <servlet-name>TestServlet</servlet-name>
        <url-pattern>/doit</url-pattern>
    </servlet-mapping>then use http://localhost:8080/testProject/doit

  • How do i run a java program an another directory?

    How do I run a java program that's in a different directory?
    I have been doing this in the command line:
    java "C:\Document and Settings\freeOn\Desktop\Java\Test\test"
    and I get
    Exception in thread "main" java.lang.NoClassDefFoundError:
    C:\Document and Settings\freeOn\Desktop\Java\Test\test
    I just thought there might be a quick way to do this and not
    have to cd to the following dir evertime i want to run an app in
    console.
    The test.java file is this:
    import java.io.*;
    public class test {
        public static void main(String args[]) {
          System.out.println("Testing.....");

    Ok I looked in the java help and found the classpath, this makes it alittle easier.
    java -cp C:\DOCUME~1\freeOn\Desktop\Java\Test\ test
    At least i can run this in the run dialog which makes it easier thanks for you help kota balaji

  • How to run the package programs in eclipse ?

    hi all,
    how to run the package programs in eclipse ?
    plz clarify...
    regards
    balakrishna.m

    package source code is
    package package1;
    public class ClassaA
              public void displayA()
                   System.out.println("class A");
         }java source code is import package1.ClassA;
         class Packagetest1
              public static void main(String args[])
                   ClassA objectA = new ClassA();
                   objectA.displayA();
         }if i write the notepad means its executing successfully..
    but in eclips is not working..
    plz help me..

  • How can I run external console program, printing output to JTextPane?

    How can I run external console program, printing output to JTextPane?
    I have a console app. written in C++ and I would like to run in it from java swing app. and I would like to see its output in a JTextPane.

    I have used this article
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    to successfully pipe output from jboss batch files to a JTextPane.

  • How can i run my java program with out java language

    Hai to every one ..Iam new to java language ...am using windows xp operating system , i did not installed java language in my system .. how can i run a java program with out installing java language... Which files is requied to run java program..?
    any one can help me??

    Hai to every one ..Iam new to java language ...am
    using windows xp operating system , i did not
    installed java language in my system .. how can i run
    a java program with out installing java language...
    you ... can ... not ... do ... this
    Which files is requied to run java program..?
    any one can help me??a JVM. Download it from sun's website.
    [url http://java.sun.com/javase/downloads/index.jsp]Download JavaSE here

  • Servlet program in eclipse

    hi all,
    i write simple hello servlet program in eclipse...
    but compiler tells " javax.servle.* " cannot be resolved...
    plz clarify how to run servlet program in eclipse as a tomcat webserver....
    import java.io.*;
    import javax.servlet.*;
    public class helloservlet extends GenericServlet{
         public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
         response.setContextType("text/html");
         PrintWriter pw= response.getWriter();
         pw.println("hello servlet");
         pw.close();
    }regards
    machepalli

    hi,
    if you are using tomcat 5.5 server use jdk1.5 and if you use tomcat 5.0 use jdk1.4 then compatability adjust.And jar files to library go to tomcat-home ->common->lib->Servelet-api.jar file to your java program library.....
    And better to use myeclipse1.4 instead of eclipse ... bcoz sometimes it requires plugins to avoid that use myelipse1.4 ......

  • Wat are all needed to be impoted to run ,deploy servlet,jsp in eclipse

    i want to know what are all needed to be impoted
    to run ,deploy servlet,jsp in eclipse
    reply me
    regards
    saravanakumar

    http://www.eclipse.org/webtools/

  • How can I run a servlet with tomcat

    I'm a new learner in servlet,I recently write a servlet program,when I compile it,the compiler throws the error
    "package javax.servlet.http does not exist",I have put the servlet.jar(which exist in d:\tomcat\bin directory) file into the classpath directory;my servlet source files are in D:\tomcat\webapps\mywork\web-inf\classes\com\stardeveloper\servlets;
    "com.stardeveloper.servlets" is the package for my servlet source files,so I have write the sentence "package com.stardeveloper.servlets;" in my servlet source file.
    I don't know how to resolve this problem.can you give me a help?

    servlet.jar doesn't exist in the folder you mentioned, but rather, in C:\tomcat40\common\lib, so this should be included in your classpath, the other thing you should care about is how you compiled your servlets, so that the package statement match the hirarchy of the file.
    regards

  • How can I run an external program without quitting Firefox?

    I want to run an external program from within Firefox, much as Outlook express is run from the email button. How do I set this up?
    Firefox doesn't import my Bookmarks from the listed html file. Any cure for this?

    I don't want to run the mail program, I want to run another program.
    Maxthon allows me to do this using External Tools. Does Firefox allow me to run other programs without leaving Firefox?
    2. Firefox allows me to load an html file which contains my bookmarks, but it doesn't load the bookmarks file. is there a solution?

Maybe you are looking for

  • MBP early 2011 battery life

    I have the early 2011 release of the 17" MBP (8gig ram, 2.2ghz quad i7, 500 gig harddrive) and it seems like the battery life has just been cut inhalf. It lasts me about 3 and a half hours from just general use. Is my battery faulty? Really appriciat

  • Jdbc receiver stored procedure call

    This is my stored procedure in sybase create procedure fn_acf2     @proj_name   char(4),     @ver         char(1),     @function_code char(4),     @ident_number char(9),     @agent_id     char(6)                    as     declare @msg char(30)     de

  • How to hide the Main Report Viewer Tab in SAP CR for VS2010?

    Is there any option to hide that tab page? In designing progress, sometimes it's really annoying. Besides, the vertical line in report appears mistakes with a tiny over-length. How to deal with it? Looking forward to your answers. Thanks.

  • Fatal iPhoto 6 error in Leopard you should know about in Leopard

    If you use an accented character in the tags in preferences, your tag library crashes (try adding another tag to see what happens). Is there any way to get my tag library back? I spent so much time on my precious photo library. They should make an ID

  • CD_Rom from book 1z0-047

    Hi! I Bought the book OCA Oracle Database - SQl Certified Expert Exam Guide (Exam 1Z0-047) from Oracle Press. But I bougth a used book and don´t have the CD-Rom with the practice questions. Anybody have this CD-Rom? I need for my certification...