Can't compile Servlet program(error in setting classpath in XP)

I encountered a similar problem as 'hereispaddy'.
"I have recently written a servlet program. When I compile the program (let's say "HelloWorld.java"), I've got the following error message:
package javax.servlet does not exist
I've download the class files and set the classpath already. Have I missed anything? "
i would like to ask, how to set the following in Windows XP:
set CATALINE_HOME=C:\PROGRA~1\APACHE~1.0
set CLASSPATH=.;%CATALINE_HOME%\COMMON\LIB\SERVLET.JAR;C:\JDK1.4\BIN;
*ive tried in control panel->system->advanced->environment variables->
variable name:CATALINE_HOME
variable value:C:\Program Files\Apache Tomcat4.0 (and)
variable name:CLASSPATH
variable value:.;%CATALINE_HOME%\common\lib\servlet.jar;C:\jdk1.4\bin
but failed!
Could anyone kindly tell me what's wrong with my setting?
Thx a lot!!!

Does Tomcat work? Can run the examples on the home page?
The only suggestion I have at this point is to get rid of the spaces in
C:\Program Files\Apache Tomcat4.0
But I am still in Win98 , so I am just guessing.

Similar Messages

  • I have jsdk2, but I can't compile servlet program

    I have jsdk2 version. which create in my c:\ dirve a folder jdk1.3. I do all the program from that. But I found that some of the class files of Servlet (servletRespose etc ) is missing. What I do to recover that. Even I can't compile any servlet program from that. Pls reply to my problems.
    Regards.
    Ranjan

    The Servlet API is part of J2EE (Java 2 Enterprise Edition). It is not included in the Standard Edition.
    So you need to download and install the J2EE reference implementation or another servlet engine such as Apache Tomcat ( http://jakarta.apache.org/tomcat ). Don't forget to put the Tomcat JAR files in your CLASSPATH when compiling your servlet program.
    Jesper

  • 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.

  • How can i compile the program?

    hi,everybody:
    I have a program which include the next statments:
    public void println(boolean flag)
    throws IOException
    Object obj = lock;
    obj;
    JVM INSTR monitorenter ;
    print(flag);
    newLine();
    obj;
    JVM INSTR monitorexit ;
    break MISSING_BLOCK_LABEL_26;
    Exception exception;
    exception;
    obj;
    JVM INSTR monitorexit ;
    throw exception;
    how can i compile the program?
    thanks

    Hi,
    I'm trying to figure out how to use this decompiler, I have downloaded it to windows 2000 platform and it unzips to 1 file with extension "1-bin" - OS doesn.'t know what to do with and neither do I ;) - I'm starting out on something here and this tool would be useful.
    Thanks for any install instructions you might have.
    mufc1999
    Hi,
    I've had a similiar problem with decompiling certain
    classes. Try the following decompiler,
    http://jrevpro.sourceforge.net, after using this one,
    the code decompiled fine, this tool is also a
    disassembler and quite a nifty one i might add. :)
    Hope this helps!
    Have Fun!

  • Help ~~ Cannot compile servlet program

    I have recently written a servlet program. When I compile the program (let's say "HelloWorld.java"), I've got the following error message:
    package javax.servlet does not exist
    I've download the class files and set the classpath already. Have I missed anything?
    Thx!

    I have recently written a servlet program. When I
    compile the program (let's say "HelloWorld.java"),
    I've got the following error message:
    package javax.servlet does not existyou donot have servlet api classes in your classpath
    I've download the class files and set the classpath
    already. Have I missed anything?just check the classpath again and compile.
    say echo CLASSPATH and see

  • Cannot compile servlet program

    I have recently written a servlet program. When I compile the program (let's say "HelloWorld.java"), I've got the following error message:
    package javax.servlet does not exist
    I've download the class files and set the classpath already. Have I missed anything?
    Thx! ^-^

    Maybe you should listen in at
    http://forum.java.sun.com/thread.jsp?forum=45&thread=234654
    He has a similar problem.
    Did you put the servlet.jar in your classpath?

  • 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

  • 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

  • How can I fix a program error so I am able to save files?

    My version of Photoshop CS6 is suddenly not allowing me to save any files at all. I can't save .psd, .jpg, .gif, etc. When I try to save it it pops up with a program error message. I haven't had this program very long so I would like to get it fixed so I can start using it. Thanks!

    Hello! I'm guessing that you either have allowed Photoshop to use an inadequate amount of disk space, which you can change by going to Edit>Preferences or you have run out of space on the disk you have told Photoshop to use. Either free up space, or, if you have a second hard drive, go to Edit>Preferences and it should be under General. I haven't gone through all of these preferences menus yet, so can't promise you'll find everything there, but you should at least get some leads. I know there are more specific options under preferences, but as I said, I haven't gone through those yet, and don't know where to find disk space options.
    Hope this helps!
    Cole

  • Help! I can't compile this program

    I copied the following program from E.Harold's book,Java Network Programming,online edition.The file name is SMTPClient.java.Its function is sending simple mails.
    When I compiled the file,there were 6 error messages indicating that the first 6 lines of code were wrong.The reasons are something like "class" or "interface" needed.
    Can anybody give me some advice?
    Source file:
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class SMTPClient extends JFrame {
    private JButton sendButton = new JButton("Send Message");
    private JLabel fromLabel = new JLabel("From: ");
    private JLabel toLabel = new JLabel("To: ");
    private JLabel hostLabel = new JLabel("SMTP Server: ");
    private JLabel subjectLabel = new JLabel("Subject: ");
    private JTextField fromField = new JTextField(40);
    private JTextField toField = new JTextField(40);
    private JTextField hostField = new JTextField(40);
    private JTextField subjectField = new JTextField(40);
    private JTextArea message = new JTextArea(40, 72);
    private JScrollPane jsp = new JScrollPane(message);
    public SMTPClient() {
    super("SMTP Client");
    Container contentPane = this.getContentPane();
    contentPane.setLayout(new BorderLayout());
    JPanel labels = new JPanel();
    labels.setLayout(new GridLayout(4, 1));
    labels.add(hostLabel);
    JPanel fields = new JPanel();
    fields.setLayout(new GridLayout(4, 1));
    String host = System.getProperty("mail.host", "");
    hostField.setText(host);
    fields.add(hostField);
    labels.add(toLabel);
    fields.add(toField);
    String from = System.getProperty("mail.from", "");
    fromField.setText(from);
    labels.add(fromLabel);
    fields.add(fromField);
    labels.add(subjectLabel);
    fields.add(subjectField);
    Box north = Box.createHorizontalBox();
    north.add(labels);
    north.add(fields);
    contentPane.add(north, BorderLayout.NORTH);
    message.setFont(new Font("Monospaced", Font.PLAIN, 12));
    contentPane.add(jsp, BorderLayout.CENTER);
    JPanel south = new JPanel();
    south.setLayout(new FlowLayout(FlowLayout.CENTER));
    south.add(sendButton);
    sendButton.addActionListener(new SendAction());
    contentPane.add(south, BorderLayout.SOUTH);
    this.pack();
    class SendAction implements ActionListener {
    public void actionPerformed(ActionEvent evt) {
    try {
    Properties props = new Properties();
    props.put("mail.host", hostField.getText());
    Session mailConnection = Session.getInstance(props, null);
    final Message msg = new MimeMessage(mailConnection);
    Address to = new InternetAddress(toField.getText());
    Address from = new InternetAddress(fromField.getText());
    msg.setContent(message.getText(), "text/plain");
    msg.setFrom(from);
    msg.setRecipient(Message.RecipientType.TO, to);
    msg.setSubject(subjectField.getText());
    // This can take a non-trivial amount of time so
    // spawn a thread to handle it.
    Runnable r = new Runnable() {
    public void run() {
    try {
    Transport.send(msg);
    catch (Exception ex) {
    ex.printStackTrace();
    Thread t = new Thread(r);
    t.start();
    message.setText("");
    catch (Exception ex) {
    // I should really bring up a more specific error dialog here.
    ex.printStackTrace();
    public static void main(String[] args) {
    SMTPClient client = new SMTPClient();
    // Next line requires Java 1.3 or later. I want to set up the
    // exit behavior here rather than in the constructor since
    // other programs that use this class may not want to exit
    // the application when the SMTPClient window closes.
    client.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    client.show();
    Message was edited by:
    oscarhua

    1:install Java SE,set the path variable to the directory of the bin folder(including bin).
    2:download the JavaMail 1.4 release from http://java.sun.com/products/javamail/downloads/index.html
    3:extract the downloaded file to any location and add the directory of its mail.jar file to classpath.
    4:download the JavaBeans Activation Framework 1.1release from
    http://java.sun.com/products/javabeans/jaf/downloads/index.html#download
    5:extract the downloaded file to any location and add the directory of its activation.jar file to classpath.
    then everything goes smoothly
    You inspired me and voronetskyy told me exactly what to do,so thak both of you again!:-)
    Message was edited by:
    oscarhua

  • Depois de Atualizar para Mac 10.9 não consigo mais baixar Programas - Erro "hardware Gráfico "  (After Upgrading to Mac 10.9 I can no longer download Programs - Error "Hardware Graph" (

    Ola amigos
    Depois de atualizar para o sistema Mac OX 10.9 não consigo baixar programas e Games que tinha na versão anterior.
    Aparece um erro de " hardware Grafico não compativel"
    _____  Minha dúvida fica, porque antes eu comprei e baixo, e agora não baixa mais ?
    Alguem poderia ajudar ???
    my mac is Macbook Pro 5,2
    =============\\=============\\  in ingles     ==========================\\===============\\====================
    Hello friends
    After upgrading to Mac OX 10.9 system can not download programs and Games that had in the previous version.
    Appears an error of "hardware not compatible Grafico"
    _____ My question is, because before I bought and down, and now does not download anymore?
    Could someone help??

  • How can I compile servlets?  I'm still having problems...

    Ok, I've installed J2SE and it's been working perfectly using command-line compiling (javac) and also with the Eclipse IDE.
    Now I want to start using Servlets and JSP so I installed the JWSDP (Java Web Services Developer Pack). I couldn't quite figure it out, so I installed J2EE on top of everything.
    Eclipse doesn't recognize "import javax.servlet.*;" and neither does the command-line compiler javac.
    Am I doing something wrong?

    I don't know anything about ServletExec or how it expects you to deploy a Web app. You're on your own there. I don't know if ServletExec supports WAR files or even follows the specifications for directory structures.
    Look, there are two separate issues here: compiling and running.
    Whatever you do, however you do it, you've got to have a JAR in your CLASSPATH that has the javax.servlet and javax.servlet.http packages in it when you compile. You don't need the whole J2EE app server, just the JAR with those packages.
    When you deploy and run the app, you'll do it on the server. It'll have the appropriate JARs.
    To me, app server and J2EE are synonymous. Yes, the j2ee.jar comes with Sun ONE if that's what you've downloaded.
    You can use Tomcat, which is a free servlet/JSP engine. I believe that Sun ONE has Tomcat bundled inside. If so, it'll have the servlet.jar in there somewhere. Tomcat stores it in TOMCAT_HOME/common/lib.
    MOD

  • Can't compile Servlets in J2EE 1.4 SDK 5.0

    Hi,
    I downloaded J2EE 1.4 SDK 2005Q2 UR2 which has J2SE 5.0 and has built in support for Java Servlet implementation. But when I try to complie a Servlet, compiler cribs javax.serlet.* package can't be found.
    Some solutions suggested on this forum direct one to include j2ee.jar or servlet.jar in the classpath. I have added j2ee.jar in the classpath but still the same thing happens. And there's no servlet.jar in this instalation.
    Any pointers???

    Hi,
    I downloaded J2EE 1.4 SDK 2005Q2 UR2 which has J2SE
    5.0 and has built in support for Java Servlet
    implementation. But when I try to complie a Servlet,
    compiler cribs javax.serlet.* package can't be
    found.You realize, of course, that you misspelled "servlet" - you left out the 'v'. Check your code.
    Some solutions suggested on this forum direct one to
    include j2ee.jar or servlet.jar in the classpath. I
    have added j2ee.jar in the classpath but still the
    same thing happens. And there's no servlet.jar in
    this instalation.Right. servlet.jar is for Tomcat 4.x and earlier; it's servlet-api.jar for Tomcat 5.x and later. J2EE reference app server uses j2ee.jar.
    Did you ever think to open the JAR and make sure that the package was inside? Might be worth doing instead of taking it on faith. If you can't find it, the class loader won't, either.
    Any pointers???See above. If that's not it, you think you have the JAR in your CLASSPATH but you don't. Don't argue with the compiler. Figure out what YOU did wrong.
    %

  • Can't get edge program error fixed

    In March I edged up my wife's phone line, no problems.
    Then I edged up my line, Verizon sends me 2 phones, I call and I'm told to return the extra one.
    I return the extra phone and keep one, they cancel my edge agreement in my next bill, and now no one seems to know how to turn the edge agreement back on, I've been waiting 3 weeks and now I'm getting ready to get my next bill. why is this such a problem???

    i don't do twitter
    (removed)
    now-4;00pm
    4:45-10pm
    traveling in a no service area from 4-4:45
    a case was opened about 3 weeks ago but all they say is still working on it when they call
    Private info removed as required by the Verizon Wireless Terms of Service
    Message was edited by: Admin Moderator

  • Problem in compiling aa servlet program

    I have installed jsdk1.4.2_13
    And also installed tomcat 5.0.28
    I have set
    CATALINA_HOME==C:\Program Files\Tomcat\jakarta-tomcat-5.0.28
    JAVA_HOME ==C:\j2sdk1.4.2_13
    CLASS_PATH==
    C:\Program Files\Tomcat\jakarta-tomcat-5.0.28\common\lib\servlet-api.jar;
    C:\Program Files\Tomcat\jakarta-tomcat-5.0.28\common\lib\jsp-api.jar
    PATH ==C:\j2sdk1.4.2_13\bin;C:\Program Files\Tomcat\jakarta-tomcat-5.0.28\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
    -->My java programs are compiling
    -->I can run tomcat server , And also can see starting page of "http://localhost:8080/"
    But I am not able to compile servlet program
    MY sevlet program is
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    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</TITLE></HEAD>\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1>Hello</H1>\n" +
    "</BODY></HTML>");
    ERRORS are:
    Pakage javax.servlet does not exist
    Pakage javax.servlet.http does not exist
    cannot resolve symbol HttpServletRequest
    and similar errors
    can anyone guide me?
    Message was edited by:
    Learn

    it's not CLASS_PATH, it's CLASSPATH.
    Directory paths with spaces in them are problematic. Surround them with double quotes.
    I think the best thing is not a CLASSPATH environment variable. Better to use the -classpath option on javac.exe when you compile.
    So your command to compile might look something like:
    javac -classpath .;"C:\Program Files\Tomcat\jakarta-tomcat-5.0.28\common\lib\servlet-api.jar" *.java%

Maybe you are looking for