hi,
i have really stupid problem with compilation.
my catalogs tree looks:
D:\javrob\Piwo-w1\classes\com\example\web
D:\javrob\Piwo-w1\classes\com\example\model
and src:
D:\javrob\Piwo-w1\src\com\example\web\WyborPiwa.java
D:\javrob\Piwo-w1\src\com\example\model\EkspertPiwny.java
the .java files looks:
//------------------------------------------
package com.example.model;
import java.util.*;
public class EkspertPiwny{
public List getMarki(
String kolor){
List marki = new ArrayList<String>();
if(kolor.equals("bursztynowy")){
marki.add("Jack Amber");
marki.add("Red Moose");
} else{
marki.add("Jail Pale Ale");
marki.add("Gout Stout");
}
return (marki);
}
}
//---------------------------------------------
package com.example.web;
import com.example.model.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class WyborPiwa extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Porada piwna<br>");
String c = request.getParameter("kolor");
out.println("<br>Wybrany kolor piwa:" + c);
EkspertPiwny be = new EkspertPiwny();
List wynik = be.getMarki(c);
Iterator it = wynik.iterator();
while(it.hasNext()){
out.println("<br>Sprobuj: "+ it.next());
}
}
}
//---------------------------------------------
first i compile ExpertPiwny.java:
D:\javrob\Piwo-w1>javac -classpath v:\tomcat\common\lib\servlet-api.jar -d classes src\com\example\model\EkspertPiwny.java
Note: src\com\example\model\EkspertPiwny.java uses unchecked or unsafe operation
s.
Note: Recompile with -Xlint:unchecked for details.
So i have new .class file in correct place D:\javrob\Piwo-w1\classes\com\example\model\ExpertPiwny.class
NEXT is a problem I WANT COMPILE second file but it doesn't work :
D:\javrob\Piwo-w1>javac -classpath v:\tomcat\common\lib\servlet-api.jar -d classes src\com\example\web\*.java
src\com\example\web\WyborPiwa.java:3: package com.example.model does not exist
import com.example.model.*;
^
src\com\example\web\WyborPiwa.java:21: cannot find symbol
symbol : class EkspertPiwny
location: class com.example.web.WyborPiwa
EkspertPiwny be = new EkspertPiwny();
^
src\com\example\web\WyborPiwa.java:21: cannot find symbol
symbol : class EkspertPiwny
location: class com.example.web.WyborPiwa
EkspertPiwny be = new EkspertPiwny();
^
3 errors
Why it doesn't import needed files if EkspertPiwny.class is in correct place?
WHERE IS WRONG? why it doesn't work
thanks for any help