Compile Servlet....I can't do that!!!!

I hava a file called "LoginControlServlet.java"
in this class I use HttpServlet and other related to javax.servlet.*;
then I compile it in command promopt
"javac -classpath LoginControlServlet.java -d c:\compile"
then after compiled , no error occur..but I cannot find the LoginControlServlet.class file.......
I dont know why......anyone the professional can help me?

Hello,
The Option -classpath describes the class Files and Jar Archives,
which should be used for compiling.
The File to compile is placed at the end of the path.
In your case, if you have to include servlet.jar (located in C:\lib) :
"javac -classpath C:\lib\servlet.jar -d c:\compile LoginControlServlet.java
Best regards
jherunter

Similar Messages

  • I want to learn more about "Servlet".Where can I find that document.

    Hi ! all.
    I am really need to know about Servlet technology programming.
    Please! anyone can tell me.
    Thank you very much!

    for basics go to "JAVA How to program"
    visit dietel & dietel website
    regards
    Amar(india)

  • I can't compile servlets, either

    I am following the instruction of Java tutorial in
    "http://developer.java.sun.com/developer/onlineTraining/J2EE/Intro2/servlet/servlet.html". I copied the code for BonusCalculationServlet on my computer and tried to compile it but i couldn't. The error message it could not recognized all the javax package classes (javax.servlet...). I installed j2 ee sdk 1.3.1 and j2se 1.4.0. I set all the environmental variable correctly and i did set classpath correctly ( classpath = %J2EE_HOME%/lib/j2ee.jar).
    If i use jsdk2.1(jdk1.2.1 servlet extension) then I can compile it. Can anybody help with this. Thanks

    You need to install a servlet runner such as Tomcat and check out Apache Jakarta-Ant for performing your builds.
    http://jakarta.apache.org/tomcat/
    http://jakarta.apache.org/ant/
    Tomcat has a great little Application Developer Guide. Check that out here:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/index.html
    And check out a pre-assembled Ant build sample here:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/sample/
    Once you have Tomcat-4.1.10 set up, make appropriate changes to paths in the sample build file to match your system, drop your servlet classes into the "src" directory creating whatever package directory structure you need inside that and then just go to the command line and type:
    ant compile
    Your classes will now have been compiled and you will have your WAR structure all set to deploy to Tomcat.
    Jake

  • Compiling Servlet problem that uses a JavaBean

    I have a servlet that will get data from a JavaBean which is created before in a jsp file. While I trying to compile the servlet I am getting this message:
    --------------------Configuration: JDK version 1.3 <Default>--------------------
    Command : "C:\jdk1.3\bin\javac.exe" -d "C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes" C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java
    Directory : C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\TasitKayitGirisi.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean = (SimpleBean) session.getAttribute
    ^
    ("simpleBean");
    C:\jakarta-tomcat-3.2.1\webapps\ROOT\WEB-INF\classes\MyServlet.java:19: cannot resolve symbol
    symbol : class SimpleBean
    location: class MyPackage.SimpleBean
         SimpleBean simpleBean= (SimpleBean) session.getAttribute("simpleBean");
    ^
    2 errors
    Process completed.
    Where is the problem. SimpleBean is successfully being initializing in my jsp file. But I couldn't compile my servlet that will get data from that bean. Both my servlet and bean are in the same package. I am using JCreator to compile servlets. I think the problem is the compile string that JCreator uses. Can you help me. Thx in advance.

    Hi,
    The problem is it is not finding the Bean. Put it in the classpath.
    The simplest way is put the class in /WEB-INF/classes/MyPackage folder.

  • I FOUND : servlet-api.jar ...WHERE insert it to can compile SERVLETS

    I FOUND : servlet-api.jar in TOMCAT 6
    WHERE insert it to can compile SERVLETS ?
    where added(directory), some folders follow...?
    C:\Program Files\Java\jdk1.6.0_15\bin
    C:\Sun\AppServer\lib
    C:\Program Files\Java\jdk1.6.0_15\src\javax

    You can use any of the following methods:
    i) SET CLASSPATH variable with absolute path of your servlet-api.jar and then compile your servlet from any folder.
    ii)you can use
    C:\jdk\bin>javac -cp C:\tomcat\lib\servlet-api.jar SampleServlet.javaand after comilation put the compiled java class file to classes folder of you web application.
    [Obviously if you have any package, then you need to maintaing that folder structure inside classes folder]
    Here I assumed your javac is available at C:\jdk\bin folder and servlet-api.jar is available at C:\tomcat\lib folder
    ---Sujoy

  • Can I compiler servlet with java compiler?

    Can I compiler servlet with java compiler?
    Here is an example of it:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class HelloWorldServlet extends HttpServlet
              protected void doGet(HttpServletRequest request,
              HttpServletResponse response) throws ServletException , IOException
                        response.setContentType("text/html");
                        PrintWriter out = response.getWriter();
                        StringBuffer sb = new StringBuffer();
                        sb.append("<html><body><h1>");
                        sb.append("Hello World");
                        sb.append("</h1></body></html>");
                        out.print(sb.toString());
                        out.close();
         }

    Can I compiler servlet with java compiler?
    yes.
    just include the correct jarfiles in your classpath.

  • I can't compile servlets

    Please ignore my previous Thread.
    Where do you get the nessecary libaries to compile servlets, and what directory of the JSDK1.4.0/ directory do you put them in (Im using Win98se)

    File To Compile:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloClientServlet extends HttpServlet
         protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
         res.setContentType("text/html");
         PrintWriter out = res.getWriter();
              out.println("<HTML><HEAD><TITLE>Hello Client!</TITLE>"+
         "</HEAD><BODY>Hello Client!</BODY></HTML>");
              out.close();
         public String getServletInfo()
              return "HelloClientServlet 1.0 by Stefan Zeiger";
    Error Messages:
    C:\ServletDevelopment\HelloClientServlet.java:2: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    C:\ServletDevelopment\HelloClientServlet.java:3: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    C:\ServletDevelopment\HelloClientServlet.java:4: cannot resolve symbol
    symbol : class HttpServlet
    location: class HelloClientServlet
    public class HelloClientServlet extends HttpServlet
    ^
    C:\ServletDevelopment\HelloClientServlet.java:6: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class HelloClientServlet
         protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    ^
    C:\ServletDevelopment\HelloClientServlet.java:6: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class HelloClientServlet
         protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    ^
    C:\ServletDevelopment\HelloClientServlet.java:6: cannot resolve symbol
    symbol : class ServletException
    location: class HelloClientServlet
         protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    ^
    6 errors
    Tool completed with exit code 1

  • Unable to compile servlet files in javac

    i am unable to compile servlet *.java files in javac.as far as i can see my path is correct.
    Kindly provide a solution as soon as possible.
    My jdk1.3 is in my c drive and my tomcat in my d drive.
    if you are able to compile kindly let me know your path.
    it says symbol not resolved.i think that it is unable to import from javax

    Assuming that your jdk is in c drive as c:\jdk1.3 set the path and the classpath like as shown below. Remember that you have to set the classpath for the classes in the javax.servlet and javax.servlet.http packages. I know how to do it for JavaWebServer. JavaWebServer has a jar called servlet.jar that contains all these classes. What you need to do is to put this jar file in your classpath. There will be a similar jar file for Tomcat server also. You need to refer the Tomcat server documentation for that.
    The path and the classpath have to be set like this...
    d:\>path=%path%;.;c:\jdk1.3\bin;
    d:\>set classpath=%classpath%;.;c:\jdk1.3\lib;c:\JavaWebServer2.0\lib\servlet.jar;
    assuming tht JWS is installed in c:\JavaWebServer2.0
    Also note that there should be no spaces in between while setting the classpath. In your case you have to change the last part of the classpath to customize your requirement.
    Hope that will help.
    Regards
    Jaydeep

  • How do you set up your system to compile servlets?

    I can't compile my servlets. I need the javax.servlet packages. I went to java.sun.com/products/servlet but couldn't find the servlet SDK. Is it now all wrapped up in the J2EE SDK?
    So I downloaded the J2EE beast and put j2ee.jar in my C:\JDK1.3\jre\lib\ext. Now I can compile my servlets fine from the command line. But now Tomcat doesn't work at all. Even when I try to run the servlets that are supplied in the examples with Tomcat, I get the following errors:
    Internal Servlet Error:
    javax.servlet.ServletException: sun/tools/javac/Main
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:415)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
         at org.apache.tomcat.core.Handler.service(Handler.java:287)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
         at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
         at java.lang.Thread.run(Thread.java:484)
    These errors disappear if I remove j2ee.jar
    So, how shoudl I configure my system so taht I can run Tomcat and also compile my servlets from the command line ? Also, do I really have to keep restarting Tomcat each time I want to reload a servlet ?

    To set up Tomcat, here's what I'd do.
    1) Remove j2ee.jar from C:\JDK1.3\jre\lib\ext
    That will cause more headaches than you can imagine.
    2) Add servlet.jar to your classpath. Servlet.jar is located in lib under your tomcat directory. ( so, something like C:\jakarta-tomcat\lib\servlet.jar )
    3) Make sure that you have your JAVA_HOME environment variable set to C:\JDK1.3. If this is not set up correctly then you will get the error: sun/tools/javac/Main not found...
    Hope that helps.
    Anne

  • Not Able to compile Servlet from ?

    Hi All,
    I am not able to compile Servlet from my package:
    1) I Have set the CLASSPATH Variable using below line in System Variables:
    C:\CC4\prog\jakarta-tomcat-4.1.30\common\lib\servlet.jar
    2) Also Set the CATALINA_HOME with value
    C:\CC4\prog\jakarta-tomcat-4.1.30
    as per above setting servlet should be compiled but still i m getting error message:
    1) C:\CC4\prog\jakarta-tomcat-4.1.30\project\classes\com\example>javac ListenerTest
    er.java
    ListenerTester.java:17: cannot resolve symbol
    symbol : class Dog
    location: class com.example.ListenerTester
    Dog dog = (Dog) getServletContext().getAttribute("dog");
    ^
    ListenerTester.java:17: cannot resolve symbol
    symbol : class Dog
    location: class com.example.ListenerTester
    Dog dog = (Dog) getServletContext().getAttribute("dog");
    ^
    2 errors
    2) Error while compiling other file:
    C:\CC4\prog\jakarta-tomcat-4.1.30\project\classes\com\example>javac MyServletCon
    textListener.java
    MyServletContextListener.java:12: cannot resolve symbol
    symbol : class Dog
    location: class com.example.MyServletContextListener
    Dog d = new Dog(dogBreed);
    ^
    MyServletContextListener.java:12: cannot resolve symbol
    symbol : class Dog
    location: class com.example.MyServletContextListener
    Dog d = new Dog(dogBreed);
    ^
    2 errors
    So what could be the posible solution here :
    do reply !!!
    please
    Thanks
    prabhat

    I have added servlet.jar in the classpath. But the program is not compiling.The error message says that it can not find classes like ServletConfig, ServletException, Cookie etc. Please help.

  • 9iAS javac is running well but also want to compile Servlets

    Dears!
    I have installed Oracle 9iAS on Windows NT4.I want to develop servlet & JSP
    using Oracle 9iAS.
    I have tried compiling my servlet in Command Prompt after setting up the
    PATH for the JSDK & JDK shipped with 9iAS but i got the following error:
    Package javax.servlet not found in import.
    import javax.servlet.*;
    ^
    Supperclass HttpServlet of class (my class) not found.
    public class (my class) extends HttpServlet.
    ^
    The home of my 9iAS is as,
    e:\9ias_home & i found the JDK & JSDK folders as,
    e:\9ias _home\Apache\Jdk
    e:\9ias _home\Apache\Jsdk respectively.
    Similarly when i tried to compile the servlets(given in 9iAS) i got the
    same above error.(But Java's Application programs are running OK! and not
    Servlet & JSP etc!)
    I think that this problem is because of environmental variables etc.
    but i have set the paths but did not succeeded.i have set the path of
    JDK & JSDK using (Controll panel->System->) environment tab as
    .;e:\9ias_home\apache\jdk;e:\9ias_home\apache\jdk\bin
    ;e:\9ias_home\apache\jdk\lib\tools.jar;e:\9ias_home\apache\jsdk
    ;e:\9ias_home\apache\jsdk\bin;e:\9ias_home\apache\jsdk\lib\jsdk.jar
    .. it is very important and your help can makes a great.
    Many thanks!
    [email protected]
    null

    To set up Tomcat, here's what I'd do.
    1) Remove j2ee.jar from C:\JDK1.3\jre\lib\ext
    That will cause more headaches than you can imagine.
    2) Add servlet.jar to your classpath. Servlet.jar is located in lib under your tomcat directory. ( so, something like C:\jakarta-tomcat\lib\servlet.jar )
    3) Make sure that you have your JAVA_HOME environment variable set to C:\JDK1.3. If this is not set up correctly then you will get the error: sun/tools/javac/Main not found...
    Hope that helps.
    Anne

  • Compiling servlet with helper class

    Hello,
    I have to write a very large number of database queries and huge amount of code so I decided to make each helper *.class file for each table.
    Now I have a main servlet that should instantiate each of these helper classes and conduct DB operations:
    //Servlet code
    RescardreservationTable rv = new RescardreservationTable();
    rv.insertInfo();
    RescardPassengerTable rp = new RescardPassengerTable();
    rp.insertInfo();RescardreservationTable.class
    //does DB opsMy problem is that when I try to compile servlet, I get
    insert_data.java:172: cannot find symbol
    symbol : class RescardreservationTable
    location: class insert_data
    RescardreservationTable rv = new RescardreservationTable();
    Could somebody please tell me how I can make servlet locate my java classes that it has to use?
    Thanks,
    Victor.
    Edited by: vic_sk on Dec 9, 2008 9:29 AM

    Ok, looks like it's solved. Just forcing the compiler with -classpath to look for the required class file.

  • Compiling Servlet

    Please, can someone help me with this:
    When I try compile servlet I got This error message:
    C:\jdk1.2.2\bin>javac HTTPPostServlet.java
    HTTPPostServlet.java:9: Superclass HttpServlet of class HTTPPostServlet not foun
    d.
    public class HTTPPostServlet extends HttpServlet {
    ^
    1 error
    Why it happening and how I can avoid this.
    v.

    i assume u know that we need a java Servlet Development kit 2.0 to run a servlet other than a TOMCAT Server
    If u have jsdk2.0 installed on your machine One of the solution may be to set your classpath to <installation path>:\jsdk2.0\lib\jsdk.jar
    and then compile it and u 'll see that it has no errors
    it will work

  • Compile Servlet

    when i try to compile servlet i got error message. it can't be identify servlet classes. why is that?
    some books mention about class path to fix that problem. but i can't understand.
    can any one explain little bit deep?
    * i am using windows xp and tomcat server.
    -thanks-

    hi,
    for example your tomcat in c:\tomcat5.0 means
    set classpath=c:\tomcat5.0\common\lib\servlet-api.jar
    or
    set classpath=c:\tomcat4.1\common\lib\servlet.jar
    or find servlet.jar or servlet-api.jar (thats depend upon your tomcat version)
    give classpath for that jar file
    and compile

  • Getting error in compiling servlet

    I am trying to compile servlet and I am getting error "cannot resolve symble : class HttpServlet"
    there are 6 error almost same not resolve servlet or http. I already add jdk1.3.1 and tomcat in my path I don't understand why I am getting this error please help me.

    You need to add servlet.jar into the classpath. You can find servlet.jar in tomcat_home\lib dir.

  • [Servlet Error]-[Can't connect to X11 window server using ':0.0&#39

    i m using repot engin to disply report its running in windows well in my local machine but whn i deployeed it to test server (AIX) it gave me this error server is websphere
    E SRVE0026E: [Servlet Error]-[Can&#39;t connect to X11 window server using &#39;:0.0&#39; as the value of the DISPLAY variable.]: java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
         at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
         at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:175)
         at java.lang.Class.forName1(Native Method)
         at java.lang.Class.forName(Class.java(Compiled Code))
         at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:91)
         at java.awt.Font.initializeFont(Font.java:333)
         at java.awt.Font.<init>(Font.java:368)
         at com.actuate.ereport.engine.templateio.TmplReader.getFont(Unknown Source)
         at com.actuate.ereport.engine.templateio.TmplReader.getFont(Unknown Source)
         at com.actuate.ereport.engine.templateio.XMLTmplReader.handleFont(Unknown Source)
         at com.actuate.ereport.engine.templateio.XMLTmplReader.closeObjects(Unknown Source)
         at com.actuate.ereport.engine.templateio.XMLTmplReader.endElement(Unknown Source)
         at com.actuate.ereport.engine.templateio.XMLTmplReader.startParsing(Unknown Source)
         at com.actuate.ereport.engine.templateio.XMLTmplReader.readTemplate(Unknown Source)
         at com.actuate.ereport.engine.templateio.TmplReader.ReadTemplateFromBytes(Unknown Source)
         at com.actuate.ereport.engine.templateio.TmplReader.readTemplate(Unknown Source)
         at com.actuate.ereport.engine.ACJEngine.readTemplate(Unknown Source)
         at com.actuate.ereport.engine.ACJEngine.readTemplate(Unknown Source)
         at com.actuate.ereport.eapi.factory.DesignFactoryImpl.load(Unknown Source)
         at com.actuate.ereport.eapi.factory.DesignFactoryImpl.load(Unknown Source)
         at ccrmsweb.actions.PrintRpts.execute(PrintRpts.java:129)
    Please tell me wht exactly i have to do, i men exactly its very urgent

    Check this thread:
    Re: Can't connect to X11 window server using 'localhost:0.0'

Maybe you are looking for

  • Iphone display hard to read in sun light

    Why does Apple continue to make iphones that have displays that are almost un readable in sun light.  New os 7.0 is worse than the old version as far as displays go.

  • [SOLVED] iptables - New install, existing conf

    I copied my /etc/iptables/iptables.rules to my new install but the rules arn't being read. [root@host ~]# iptables -nvL Chain INPUT (policy ACCEPT 76 packets, 5793 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCE

  • Viewing clips

    Firstly when I open up Adobe Premiere I get a window that says, "We have detected an incompatible display driver. To get a better and faster playback performance, please update your display driver. Display driver details :Intel- Mobile Intel (R) 4 Se

  • Edit menu control from block diagram

    On my front panel I have a menu control that lists the existing file folders for saving the test data. If the operator want to add a new folder I want the Block diagram to write a new folder and add the entry to the menu control list.

  • Wireless Guest and Broadcast

    All, The design guide specifies the following limitation: "As designed, 4400 series controllers do not forward IP subnet broadcasts from the wired network to wireless clients across the EoIP guest tunnel." Does this mean that i cannot initiate a conn