Too many to list. Check out the errata page. I think that is a lot personally. I have been stuck on pages 84-85 of the book for over 2 days now. I am even working with someone who originally tested the very first Sun release and he cant figure it out.
If you can solve my problem, i will take back my earlier comments. It shouldnt be this hard. I was an old Microsoft geek, and want to learn
Java, but I've never had this much difficultly installing and compiling. For starters, jdk1.4 doesnt run with
tomcat 5 out fo the box.
Here is where i am currently stuck.
I am trying to compile the BeerSelect
servlet after adding the line
import com.example.model.*;
First off the command line compile does not work as the book says. I had to change ....servlet-api.jar:classes:. to .....servlet-api.jar (no classes:.)
Here is my code (just as the book says) and error:
.....
package com.example.web;
import com.example.model.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
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");
BeerExpert be = new BeerExpert();
List result = be.getBrands(c);
Iterator it = result.iterator();
while(it.hasNext()){
out.print("<br>try: " + it.next());
}
}
}
here is the error i get:
C:\java\MyProjects\beerV1\src\com\example\web>javac -classpath C:/tomcat/common/lib/servelt-api.jar -d classes src/com/example/web/BeerSelect.java
BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
BeerSelect.java:4: package javax.servlet does not exist
import javax.servlet.*;
^
BeerSelect.java:5: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
BeerSelect.java:9: cannot find symbol
symbol: class HttpServlet
public class BeerSelect extends HttpServlet {
^
BeerSelect.java:11: cannot find symbol
symbol : class HttpServletRequest
location: class com.example.web.BeerSelect
public void doPost(HttpServletRequest request,
^
BeerSelect.java:12: cannot find symbol
symbol : class HttpServletResponse
location: class com.example.web.BeerSelect
HttpServletResponse response) throws IOException, Servlet
Exception {
^
BeerSelect.java:12: cannot find symbol
symbol : class ServletException
location: class com.example.web.BeerSelect
HttpServletResponse response) throws IOException, Servlet
Exception {
^
BeerSelect.java:19: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:19: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
9 errors
......
Maybe i am doing something wrong, but i cant for the life of me figure it out.
Thanks,
Randy