I've tried it all out, no change. So i give you all transparently::
in a: the code of file BeerExpert.java, located in C:\DevEnv\beerV1\classes\com\example\web,
in b: the code of file BeerSelect.java, located in C:\DevEnv\beerV1\classes\com\example\model,
in c: the javac output when compiling file "BeerSelect.java" from C:\DevEnv\beerV1>
in d: the set of the classpath (in Windows XPSP2)
a)code of file BeerExpert.java (the compilation here works fine):
package com.example.model;
import java.util.*;
public class BeerExpert {
public List getBrands (
String color) {
List brands = new ArrayList();
if (color.equals("amber")) {
brands.add("Jack Amber");
brands.add("Red Moose");
}
else {
brands.add("Jail Pale Ale");
brands.add("Gout Stout");
}
return brands;
}
}
b)code of file BeerSelect.java (the compilation here fails, see ouput below):
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 a =new BeerExpert();
List result =a.getBrands(c);
Iterator it = result.iterator();
while(it.hasNext()) {
out.print("<br>try:"+it.next());
}
}
}
c) compiler output:
C:\DevEnv\beerV1>javac -d classes src/com/example/web/BeerSelect.java
src/com/example/web/BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert a = new BeerExpert();
^
src/com/example/web/BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert a = new BeerExpert();
^
3 errors
C:\DevEnv\beerV1>javac -d classes src/com/example/web/BeerSelect.java
src/com/example/web/BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert a = new BeerExpert();
^
src/com/example/web/BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert a = new BeerExpert();
^
3 errors
d) classpath set in the system variables screen: "C:\Program Files\Tomcat\common\lib\servlet-api.jar; C:\DevEnv\beerV1\src; C:\DevEnv\beerV1\classes;"