Re: Beginner Servlet Question
From: Nathan Zumwalt (nathanz_at_hotmail.com)
Date: 10/20/03
- Previous message: Doyle: "Re: Special characters in java, oracle and html"
- In reply to: Sally Mayne: "Beginner Servlet Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Oct 2003 11:49:16 -0700
The problem is the way you're specifying your classpath. Try putting
the path to your servlet.jar file in quotes:
javac -classpath "C:\Program Files\Apache Group\Tomcat
4.1\common\lib\servlet.jar" DontPanic.java
Also, be sure you don't have a space between the "-" and "classpath".
You'll also need to modify your DontPanic class to extend the
javax.servlet.http.HttpServlet class.
-Nathan
Sally Mayne <nospam@nospam.com> wrote in message news:<Unpkb.8507$At.5193@edtnps84>...
> Hi:
>
> I am just starting on Servlets and I haven't got too far. I can't seem to
> run the program.
>
> System: WinXP, Tomcat 4.1.27
>
> The servlet file is called DontPanic.java - the code is given at the botton
> of this email.
>
> The steps I took are:
>
> - I placed the java servlet in C:\Program Files\Apache Group\Tomcat
> 4.1\webapps\examples\WEB-INF\classes
> - I attempted to run this servlet by typing: javac - classpath C:\Program
> Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar DontPanic.java
> - I received the error message :"javac: invalid flag: Files/Apache""
>
> What have I done wrong - this has been puzzling me for most of today :(
>
> The code for DontPanic.java:
>
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
>
> public class DontPanic {
>
> public void doGet(
> HttpServletRequest request,
> HttpServletResponse response
> )throws IOException, ServletException
>
> {
> response.setContentType("text/html");
> PrintWriter out = response.getWriter();
>
> out.println("<html>");
> out.println("<head>");
> out.println("<title>Don't Panic</title>");
> out.println("</head>");
> out.println("<body>");
> out.println("<h1>Don't Panic</h1>");
> out.println("</body>");
> out.println("</html>");
> }
> }
- Previous message: Doyle: "Re: Special characters in java, oracle and html"
- In reply to: Sally Mayne: "Beginner Servlet Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]