• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beer Question from Head First

 
David Kennedy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Im attempting to compile the beer question from the Head First book
but i keep getting this error

U:\MyProjects\beerV1>javac -classpath /apache-tomcat-6.0/lib/servlet-api.jar;classes:. -d classes src/com/example/web/BeerSelect2.java
src\com\example\web\BeerSelect2.java:4: package com.example.model does not exist

import com.example.model.*;
^
src\com\example\web\BeerSelect2.java:21: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect2
BeerExpert be = new BeerExpert();
^
src\com\example\web\BeerSelect2.java:21: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect2
BeerExpert be = new BeerExpert();
^
3 errors

==================================================================

This is my BeerSelect2 java file and I do have the BeerExpert class file in
U:\MyProjects\beerV1\classes\com\example\model.

package com.example.web;
import com.example.model.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class BeerSelect2 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");

BeerExpert be = new BeerExpert();
List result = be.getBrands(c);
Iterator it = result.iterator();

while (it.hasNext()) {
out.print("<br>try: " + it.next());

}
}
}

I cant figure out what I am doing wrong to compile it.
Any help would be great.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic