Compile time ERROR ...

My directory structure is:

C:
MyProjects😔this is folder . EVERYTHING followed by ":" is folder)
beerV1:
src,classes (sub-folders)
................................................................
src folder contains:

src:
com:
example:
web,model (sub-folders)

web folder contains:
BeerSelect.java (file)
>>>>
model folder contains:
BeerExpert.java (file)
................................................................................
similarlly classes folder contains:

classes:
com:
example:
web,model

web:
(this folder does not contain file yet.BeerSelect.class file goes here after successful compilation)

model:
BeerExpert.class
...............................................................................

now when i compile BeerSelect.java like:

C:\MyProjects\beerV1>javac -classpath C:/tomcat/common/lib/servlet-api.jar -d classes src/com/example/web/BeerSelect.java

Three ERRORs:


src/com/example/web/BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/BeerSelect.java:17: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
src/com/example/web/BeerSelect.java:17: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
3 errors

.............................................................................
BeerExpert.java has code:

package com.example.model;

import java.util.*;

public class BeerExpert
{
public List getBrands(String c)
{
List arr = new ArrayList();
if(c.equals("amber"))
{
arr.add("Jack Amber");
arr.add("Red Moose");
}
else
{
arr.add("Jail Pale Ale");
arr.add("Gout Strout");
}
return(arr);
}
}
.............................................................................
BeerSelect.java has code:

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(HttpServletResponse response,
HttpServletRequest request)
throws IOException,ServletException
{
String c = request.getParameter("color");
BeerExpert be = new BeerExpert();
List a = be.getBrands(c);

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Selection Beer Advice
");

Iterator i = a.iterator();
while(i.hasNext())
{
out.println("
try: "+ i.next());
}
}
..............................................................


MAIN PROBLEM LIES WITH IMPORTING OF PACKAGE IN BeerSelect.java
and ERROR is Package not exist but it exist...

Replies

You are reading an archived discussion.

Related Posts

Ah! debate since ages is taking reality form. here comes the fact. An BOT of University of Aberystwyth named ADAM can think and make descisions and the stunner part here...
Hello everyone, Im having a broadband connection of 256k but the downloading speed is not going above 30k. When i complained to my isp provider they said that its not...
Hii all, Of the following which is the best types of PN codes for Direct Sequence Spread Spectrum - Barker, walsh, gold, kasami or MLS? Thank you..
Hi! I have a proposed solution but I'm not sure if it's right. I first did an analysis with the shank/lower leg given the angular velocity and acceleration of the...
I want to extract the content of one pdf file and want to store it in Text File using java..How to convert this..?Is there any Inbuilt class is available for...