Trouble compiling Servlets... simple problem?

PATH: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\PROGRA~1\ULTRAE~1;C:\j2sdk1.4.0\bin;C:\j2sdkee1.3.1\bin
CLASSPATH: C:\j2sdkee1.3.1\lib\j2ee.jar;C:\j2sdkee1.3.1\lib\j2eetool.jar
Yet for some reason I can't compile anything using the servlet packages. I had been able to compile in the past, but I added a new value to the PATH and CLASSPATH variables to try to get Tomcat4.0.1 to work, and then this morning I ceased to be able to compile. So I went back to my old values and can't compile! (DataServlet.java:3: package javax.servlet does not exist
import javax.servlet.*; )
Please help. Thank you.

Ok, I just wrote this post, closed the command prompt I was trying to compile in, reopened another, and tried to compile again and it worked. Can someone tell me what this is about?

Similar Messages

  • Trouble compiling servlet example

    Hi All, I am trying out an example for servlets and I ran into trouble compiling the the file called "FormProcessingServlet.java" in tutorial located here: http://developer.java.sun.com/developer/onlineTraining/Servlets/Fundamentals/magercises/FormPostingAndProcessing/index.html
    The exact problem happens in this line:
    isStructure = context.getResourceAsStream(paramStructureFile[0]);
    The error says:
    FormProcessingServlet.java:127: cannot resolve symbol
    symbol : method getResourceAsStream (java.lang.String)
    location: interface javax.servlet.ServletContext
    isStructure = context.getResourceAsStream(paramStructureFile[0]);
    anyone else ran into this problem? How do I fix this? Thanks.

    "cannot resolve symbol" means that the JVM can't find a particular class.
    Adjust your systems classpath variable to include all the jar files that you use, I also add "." to include files in the current directory I'm working from.

  • Trouble compiling servlets with J2SE 5

    Hello,
    I've been using Sun 1 Studio CE, and more recently, Netbeans 3.6, with J2SE 1.4.2. I have some basic swing applets and servlets that I wrote for my business' web site.
    I recently downloaded and installed the new software bundle containing Netbeans 4.0 and J2SE 1.5. When I try to compile my servlets, I get a compiler error that packages javax.servlet.* and javax.servlet.http.* do not exist.
    I reinstalled J2SE 1.4.2 and Netbeans 3.6 and the servlets compile fine.
    Why is JDK 5 not able to find these packages? My understanding is that they're part of the Java Servlet API, which I never explicitly downloaded previously. Is that the piece of the puzzle that I'm missing? Please help!
    Thanks

    Thanks for your response...
    What is interesting is that I never explicitly installed the Servlet API. Out of curiosity, I searched my computer for servlet*.jar and came up with 13 files including:
    servlet-2.2.jar
    servlet-2.3.jar
    servlet-api-2.4.jar
    These were located in subdirectories under Netbeans 3.6 and Tomcat 5.0.19. Therefore, I'm assuming that when I downloaded the JDK 1.4.2/Netbeans 3.6 bundle from the Java site, the Servlet API must have been part of the bundle.
    ****Let me check something...***
    I've just done the same search for servlet*.jar on my test PC, which has the Netbeans 4.0/JDK 5 bundle installed. The same files exist, in the same locations(almost the same, anyway; the Tomcat and Netbeans 4 directory structures are a little different).
    Both software bundles contain the same files, yet 1.4.2 compiles without any problems or additional configuration. In other words, I reinstalled the old 1.4.2/ Netbeans 3.6 bundle, took my existing source code, and started compiling.
    Any ideas why the same isn't true for JDK 5/Netbeans 4? I know there are changes to the way Netbeans 4.0 deals with Class Paths, but I thought that was for the classes I've written. Shouldn't the compiler be able to find the servlet API, since it bundled/installed with everything else?
    Thanks

  • Problem in compiling servlet

    hi
    i'm trying to compile a simple servlet
    my directory structure is as follows
    c:\pr1
    |
    |____src
    |
    |______chservlet.java
    |
    |____classes
    |
    |____etc
    |
    |______web.xml
    c:\Tomcat5.0
    |
    |____webapps
    |
    |______ch1
    |
    |____WEB-INF
    |
    |____classes
    and the list of variables is as follows
    TOMCAT_HOME=c:\Tomcat 5.0\bin
    JAVA_HOME=c:\jsdk1.4
    classpath = %CLASSPATH%;c:\Tomcat 5.0\common\lib\servlet-api.jar
    now when i'm trying to compile the servlet by giving the following command
    javac -classpath ".;c:\Tomcat5.0\common\lib\servlet-api.ajr" -d classes c:\pr1\src\chservlet.java
    i'm getting the error package..
    javax.servlet.* doesnt exist
    can anybody help me at the earliest
    Regards
    jaismeen

    sorry guys..for starting each time new thread..just registered myself to the site yesterday after facing this problem..so cudnt get familiar with its working..
    i have given the commands as follows..
    set classpath=c:\Tomcat5.0\common\lib\servlet-api.jar,%classpath%
    set path=c:\jsdk1.4\bin;%path%
    javac c:\pr1\src\chservlet.java
    getting the following errors
    C:\>javac c:\pr1\src\chservlet.java
    c:\pr1\src\chservlet.java:1: package javax.servlet does not exist
    import javax.servlet.*;
    ^
    c:\pr1\src\chservlet.java:2: package javax.servlet.http does not exist
    import javax.servlet.http.*;
    ^
    c:\pr1\src\chservlet.java:5: cannot resolve symbol
    symbol : class HttpServlet
    location: class chservlet
    public class chservlet extends HttpServlet
    ^
    c:\pr1\src\chservlet.java:7: cannot resolve symbol
    symbol : class HttpServletRequest
    location: class chservlet
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOExcep
    tion
    ^
    c:\pr1\src\chservlet.java:7: cannot resolve symbol
    symbol : class HttpServletResponse
    location: class chservlet
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOExcep
    tion
    ^
    5 errors
    was just wondering.ihave windows xp..so does it effect in anyway(it shud not)
    and if name of the servlet is given wrong then it shudnt give these set of errors..it shud give kind a"cudnt find the file name"
    and i have checked the classpath..servlet-api.jar is present and is in this location
    c:\Tomcat 5.0\common\lib
    and i had tried giving the command
    jar -tvf servlet-api.jar..
    it gives the list of classes..which shows..its present in the directory
    jdk is present in c:\jsdk1.4
    location of servlet is c:\pr1\src\chservlet.java
    servlet code is as follows
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class chservlet extends HttpServlet
    public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException
    PrintWriter out =res.getWriter();
    java.util.Date today= new java.util.Date();
    out.println("<html>"+
    "<body>"+
    "<h1 align=center>HF\'s Chapter1 Servlet<h1>"
    +"<br>"+today+"</body>"+"</html>");
    even i tried copynig servlet-api.jar in the same directory as the servlet and compiling it..
    it gives the same set of errors
    am just wondering what cud be the problem.sure..must b very smal..but i m not progressing much
    regards

  • Problem while compiling Servlet

    M using Tomcat.
    Environment variables :
    Variable :::::::::::::::: Values
    %TOMCAT_HOME% ::::::::::: C:\Tomcat\bin
    CLASSPATH :::::::::::::::: .;C:\jdk 1.4.2\lib;C:\jsdk2.1 \servlet.jar;C:\Tomcat\lib\servlet.jar;
    PATH ::::::::::::::::::::: ;C:\jdk 1.4.2\bin
    JAVA_HOME :::::::::::::::: C:\jdk 1.4.2
    Now problem is that When m trying to compile GreetingServlet.java
    problems are:::
    GreetingServlet.java:31: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("<BODY>");
    ^
    GreetingServlet.java:32: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("<p>"+message +","+name+"</p>");
    ^
    GreetingServlet.java:33: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("<p> Thanks ("+email+")</p>");
    ^
    GreetingServlet.java:34: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("<p> -The Pro Java Team.</p>");
    ^
    GreetingServlet.java:35: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("</BODY>");
    ^
    GreetingServlet.java:36: cannot resolve symbol
    symbol : method Println (java.lang.String)
    location: class java.io.PrintWriter
    out .Println("</HTML>");
    ^
    Source Code:
    import javax.servlet.* ;
    import javax.servlet.http.* ;
    import java.io.* ;
    import java.util.* ;
    public class GreetingServlet extends HttpServlet{
    protected void doPost (HttpServletRequest request,
                   HttpServletResponse response)
                        throws ServletException, IOException {
         String name = request.getParameter ("name");
         String email = request.getParameter ("email");
         String message = null;
         GregorianCalendar calendar = new GregorianCalendar();
         if (calendar.get(Calendar.AM_PM) == Calendar.AM) {
              message =" Good Morning";
         else {
              message = " Good Afternoon";
         response.setContentType("text/html");
         PrintWriter out = response.getWriter();
         out .println("<HTML>");
         out .Println("<BODY>");
         out .Println("<p>"+message +","+name+"</p>");
         out .Println("<p> Thanks ("+email+")</p>");
         out .Println("<p> -The Pro Java Team.</p>");
         out .Println("</BODY>");
         out .Println("</HTML>");
         out .close();
    Thanks in Advance
    Please its an urjent.
    Hoping to get the solution soon from cream like you in Programming.

    hi
    it could be you have caps P.
    try:
    "println" instead of "Println".

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

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

  • 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

  • A simple problem in j2sdk

    I am in a great problem with a very simple problem. I am new to J2EE. I had installed j2sdk1.4.0_03 / tomcat 4.1 in windows 2000. my problem is that the servlets are not being compiled. The error is " package javax.servlet is not found". error are also there in all the classes of this packege like in HttpServletResponse, HttpServletRequest etc.
    The classpath are correct. One of my friend is working with the same version and with the same classpath but in Windows XP..
    can anyone tell me why this is happening. and how to overcome this. PLEASE...............

    Add the jar that contains the javax.servlet package to your javac classpath using the -classpath option. Not sure why your CLASSPATH isn't working maybe youi have some invalid characters or directories with spaces that aren't quoted etc... I believe the servlet APIs are in servlet-api.jar, or at least they are in 5.0. Also please searxh the forums in the future this is a pretty typical question and has been answered numerous times.

  • Servlet.jar problem

    Hi all
    Could anyone help me out this problem, I keep trying to figure it out these days but I still cant find my way.
    I cannot compile a simple HelloWorldServlet.java, as it gave me 6 errors:
    ===========================================
    package javax.servlet does not exist
    import javax.servlet/*;
    ^
    package javax.servlet.http does not exist
    import javax.servlet.http/*;
    ^
    the other 4 errors also pointing to the HttpServlet, HttpServletRequest, HttpServletResponse and ServletException
    ===========================================
    I have installed Tomcat 4.1.24 and j2sdk1.4.1_01 on my computer. I know the compiler javac needs the servlet.jar when compiling servlet source code, so I have set the path like this
    PATH C:\WINDOWS;C:\WINDOWS\COMMAND;C:\J2SDK1.4.1_01\BIN;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar
    However, same errors are still generated after I set the path. So can anyone can tell me what thing goes wrong with my setting? or this is not the servlet.jar and path problem?
    With uncountable thank : )
    Kelvin

    Hi,
    My questions are the same.
    But I have also set up the classpath for the servlet component.
    After that, I found I can't call user-defined obecjts in my servlet.
    Even when I just write a simple Java command-line progarm which call the outside objects, it also can't find the user-defined objects; unless I move out the setup of CLASSPATH. So does anyone have the further solution? or tell me where I can find the answer!
    Thank you so much!

  • Trouble compiling for printed documentation

    hello, i am having trouble compiling a new document layout i
    have created, i have followed peter grainges instructions on his
    website but it always fails to generate straight away. Im using
    Robohelp x5 with word 2000, does anyone have any ideas?
    thanks steve

    Steve
    Was RH installed on the PC you are using with you logon or
    that of the person whose job you have taken over? It sounds very
    much like the latter and this is exactly what I would expect to
    happen.
    Try creating a new project with just a couple of topics and
    printing from that. It will likely also fail. If it does that
    pretty much confirms my theory. Uninstall and reinstall RH with
    your logon and with admin rights attached and the problem will
    likely go away.

  • Trouble compiling a stored procedure

    Hello, I have trouble compiling a stored procedure. I include part of the code because I think the key problem is illustrated in these lines:
    date1 is declared as a DATE.
    index_value2 NUMBER;
    BEGIN
    date1 := (select sysdate from dual);
    index_value2 := (select index_value from tmsdat.a_index_values where price_date < (SELECT sysdate -180
       FROM dual) and price_date > (SELECT sysdate -210
       FROM dual));
    [\code]
    The problem seems to be that a more complex syntax is included in the allocation statement (:=), can that be the case? That is, no select etc??
    How is this solved?
    Any help much appreciated!
    best regards
    Harald                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Well, actually WhiteHat´s magic did the trick, but two errors:
    temp := (select (to_number(to_char(sysdate, 'DD'))-1)/(decode(to_char(sysdate,'MM'),'02',28,30)) as result
       from dual);
    [\code]
    this line generates problems but I think the approach is the same maybe, that is:
    select to_number(to_char(sysdate, 'DD'))-1)/(decode(to_char(sysdate,'MM'),'02',28,30)) into temp as result frmo dual
    Further, some error about encountering end of line?
    END CONVERT_MARKET_INDEX;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Having trouble compiling

    I am a total newbie at programming and I am having trouble compiling. In the MS-DOS prompt, I located the folder where my .java file is located and typed the following:
    javac SampleProgram.java
    I received a "Bad command or file name" error. I am typing the names correctly. I am using Java 2 SDK, Standard Edition Version 1.3.1. Am I doing something wrong?
    Thanks for any help.

    That should fix it. The problem is that DOS needs to know where to find the executable files like javac.exe
    You can either set the path temporarily by typing
    SET PATH=.;c:\jdk1.3.1\bin
    at the command prompt each time you open a command window, or you can set it more permanently by adding it to your startup config. This will depend on your OS. On win 98 for example, there is an AUTOEXEC.BAT (usually with a SET PATH command already present). You could open this in notepad to add/change:
    SET PATH=C:\WINDOWS
    to
    SET PATH=C:\WINDOWS;.;C:\JDK1.3.1\BIN
    Reboot to make the changes take effect. Other OS's may have a special dialog to set this kind of command.
    Hope this helps some.

  • How to compile a simple "Hello World" program in Java by using Netbeans

    Hi all, I am very new to java programming arena. i am trying to learn the most demanding language for the time being. To program, i always use IDE's as it makes programming experience much easier by underline the syntax errors or sometimes showing codehint. However, I am facing some problem when i use Netbeabs to compile a simple "Hello world" program. my problem is whenever i write the code and press compile button, netbeans says "main class not found". Consequently,i am becoming frustated. So, i am here in this forum to get some kind help on How i can compile java programs in Netbeans. Please help me out, otherwise i may lose my enthusiasm in Java. please help me, i m stuck

    Go to http://www.netbeans.org/
    You should find tutorials there.

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

Maybe you are looking for

  • Missing soap action in the soap axis receiver adapter ?

    Hi Guys, I could not find the soap action field in the soap receiver adapter and i followed the OSS note Note 1054986 - SOAP (Axis) receiver adapter's SOAPAction field missing Please apply the following patch and use the handler parameter defaultSOAP

  • Failed Quicktime Error -2045

    FCP X and Compressor 4 will no longer generate a movie file when I submit it.  I cannot get a movie to generate from FCP X either.  Instead, I get an error after submitting that says Failed: QuickTime Error: -2045.  I have uninstall and reinstall FCP

  • Different result executing by EXEC and by job

    Greetings! I've got simple procedure: CREATE OR REPLACE PROCEDURE alertlog.check_log IS IP_ADDRESS VARCHAR2(16); BEGIN SELECT sys_context('USERENV','IP_ADDRESS') INTO IP_ADDRESS FROM sys.dual; FOR alert_conn IN (SELECT alert_date,alert_text FROM aler

  • Tagging strategy: do you include spaces in names?

    I'm gearing up to perform the Big Tag Chore, and I'm hoping to get it mostly right the first time -- I'd be grateful for any suggestions/tips you might have to share. For example, if you tag somebody by full name is it a bad idea to include a space b

  • [Software] Switch Left/Right speake

    Hi, I want to switch my front left and front right speaker output with software, because I am unable to switch them physically. Is there any way to do this? If its needed I am able to switch my rear speakers physically so something that switches both