tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike W-M" <m...@ward-murphy.co.uk>
Subject Re: Tomcat setup question.
Date Tue, 17 Dec 2002 01:39:32 GMT
As an earlier poster pointed out, it's not:
import java.servlet.*;
import java.servlet.http.*;
It's:
import javax.servlet.*;
import javax.servlet.http.*;

Try that?  (You'll still need the jar in your classpath (unless there's a
script doing something clever with the _HOME variables that I don't know
about).)
Also, I tend not to use pathnames with spaces in, just in case.

Mike.

----- Original Message -----
From: "Patrick Martz" <PMartz@teltone.com>
To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
Sent: Tuesday, December 17, 2002 1:26 AM
Subject: RE: Tomcat setup question.


Ok here's the current setup I have:

1) The j2sdk installed in C:\j2sdk
2) The j2ee installed in C:\j2ee (because this supposedly contains what I
need)
3) Tomcat installed in C:\Program Files\Apache Group\Tomcat 4.1
4) The following environmental variables set:
   a) J2EE_HOME = C:\j2ee
   b) JAVA_HOME = C:\j2sdk
   c) Both C:\j2ee\bin and C:\j2sdk\bin added to PATH.
   d) TOMCAT_HOME = C:\Program Files\Apache Group\Tomcat 4.1
   e) There is no CLASSPATH variable set.

I have noted that "C:\j2ee\lib\j2ee.jar" contains the HttpServlet class as
does "C:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar". If I
try to compile, my compiler (from Sun) fails to import java.servlet.* and
java.servlet.http.*. If I try to add the .jar file the classpath, it still
fails to compile. Below is the servlet (it's very simple, I just want to get
this thing working!).


import java.io.*;
import java.util.*;
import java.servlet.*;
import java.servlet.http.*;

public class Test extends HttpServlet
{
    public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

        res.setContentType("text/html");
        PrintWriter out = res.getWriter();

        out.println("<HTML>");
        out.println("<HEAD><TITLE>Test</TITLE></HEAD>");
        out.println("<BODY>");

        out.println("test");
        out.println("</BODY>");
        out.println("</HTML>");
    }
}

-----Original Message-----
From: Peng Tuck Kwok [mailto:pengtuck@makmal.net]
Sent: Monday, December 16, 2002 5:10 PM
To: Tomcat Users List
Subject: Re: Tomcat setup question.


Don't panic, just attach a sample servlet that you were trying to
compile to the list. I'll have a look at it and try to get it to compile
ok? The javac -classpath should work by the way.

Patrick Martz wrote:
> Thank you for the help. However, I tried that...I added the directory
where
> servlet.jar is located to the classpath. Once I do that, it no longer
> recognizes ANY of the other classes in its own directory, and therefore
> cannot make any references to them. I am frankly stumped....and I
apologize
> for my ignorance but this is all very new to me.
>
> -----Original Message-----
> From: Peng Tuck Kwok [mailto:pengtuck@makmal.net]
> Sent: Monday, December 16, 2002 5:00 PM
> To: Tomcat Users List
> Subject: Re: Tomcat setup question.
>
>
> Tomcat comes with servlet.jar, which has all the classes you need. Or
> you can download a copy from Sun Microsystems as well. Just point your
> compiler to the servlet.jar or add it to the classpath.
> If you unpack the servlet.jar with winzip you'll see what I mean. Plus I
> think it is javax.servlet, not java.servlet.
>
> Patrick Martz wrote:
>
>>Ok this is exactly my problem. These aren't MY jar files. These are jar
>>files that came with Tomcat. Apparently, the standard J2SDK does NOT come
>>with the servlet classes that I need to compile java servlets. So
>
> therefore,
>
>>when I try to import java.servlet.* it fails miserably. Even the classes
>>that come WITH Tomcat itself (for example, HelloWorldExample in the
>
> examples
>
>>directory) are not compilable. Therefore, clearly, something needs to be
>>done so that the java compiler can find these packages. Exactly what that
>
> is
>
>>I do not know and would be very appreciative if anyone could help!
>>
>>-----Original Message-----
>>From: Peng Tuck Kwok [mailto:pengtuck@makmal.net]
>>Sent: Monday, December 16, 2002 4:41 PM
>>To: Tomcat Users List
>>Subject: Re: Tomcat setup question.
>>
>>
>>
>>
>>
>>
>>
>>>So do I need to add an environmental variable to let my compiler find
>>
>>these?
>>
>>
>>>Or do I just need to move the .jar files to the right location? How do I
>>>know which .jar files are the correct ones to use (as I mentioned, there
>>
>>are
>>
>>
>>>a number of them that seem to have what I'm looking for)?
>>
>>
>>You can do any of the steps you have suggested yourself or you could
>>also just tell the compiler where to find your jars. javac -classpath
>>would do the trick
>>
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail:
>><mailto:tomcat-user-help@jakarta.apache.org>
>>
>>--
>>To unsubscribe, e-mail:
>
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>
>>For additional commands, e-mail:
>
> <mailto:tomcat-user-help@jakarta.apache.org>
>
>>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:tomcat-user-help@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message