I am trying to run the example given in the third chapter of the HFSJ.. 1)I created the HTML and DD...and run the program . Executed perfectly. 2)Created the First Version of Servlet BeerSelect.java and executed perfectly. 3)Created the BeerExpert.java,compiled and copied a copy of .class file of BeerExpert in com/example/model packege. 4)Modiefied the first verion of servlet to second version as below
5)But when i tried to compile the BeerSelect.java, i am getting an error As- BeerSelect.java:3: package com.example.model does not exist import com.example.model.*; ^ So what is the mistake i have done here..please anybody suggest me ,what i have to do to execute it correctly.
Do you remember what you learned at SCJP about compiling classes in packages ? Try to think about how to make sure that the compiler will find "com.example.model". If you still struggle, you can try the ranch's search as this question is being asked quite often.
You must have created your application inside webapps folder of tomcat .
What you have to do is inside the WEB-INF folder of your project first create a classes folder anf then place create folder stuctuer for the BearSelect.java (i mean create com/example/model) and place .class file here .
I checked the past reply,i tried everything they have mentioned. I changed my import statement as-import com.example.model.BeerExpert; I created the src directory and tried to compile from src. Then also its giving the same error.