• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compiling problem with HF JSP book

 
Fritz Urling
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm confused...

i have written the BeerSelect.java file. i put it in my MyProjects/Beer-v1/src/com/example/web directory.

from the Beer-v1 directory, i enter the following:

H:\MyProjects\Beer-v1>javac -classpath \tomcat\apache-tomcat-5.5.17\common\lib\servlet-api.jar -d classes src\com\example\web\BeerSelect.java


and it compiles.

the book, however, says to use this:

H:\MyProjects\Beer-v1>javac -classpath \tomcat\apache-tomcat-5.5.17\common\lib\servlet-api.jar:classes:. -d classes src\com\example\web\BeerSelect.java


this gives me the following:

src\com\example\web\BeerSelect.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
src\com\example\web\BeerSelect.java:4: package javax.servlet.http does not exist
import javax.servlet.http.*;


what am i doing wrong?

here is my source code:


package com.example.web;

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

public class BeerSelect extends HttpServlet {

public void doPost (HttpServletRequest request,
HttpServletResponse response )
throws IOException, ServletException {
response.setContentType ("text/html");
PrintWriter out = response.getWriter();
out.println("Beer Selection Advice<br>");
String c = request.getParameter("color");
out.println("<br>Got beer color " + c );
}

}

 
Surendra Kumar
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you're compiling your Java source on Windows. And you have to use semicolon( to seperate the classpath directories instead of colon ( .
 
Fritz Urling
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now i feel like an idiot.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic