Hi,
Below is the folder structure for my development environment:
Problem
---------
I am learning MVC and for that I tried to execute the simple program which includes Plain
Java Coding(Model),
Servlet(Controller) and
JSP and HTML(View).
Actually, I want to compile the servlet in which it creates the instance of the class (BeerExpert) and use the method of that class BeerExpert.
While I compiling I am getting the package no found error:
The code I am executing:
Servlet Coding(Controller): The Plain Java Code(Model) It's source file has been kept in
D:\MyProjects\beerV1\src\com\example\model\
and class file in
D:\MyProjects\beerV1\classes\com\example\model\
and
C:\Tomcat\webapps\Beer-v1\WEB-INF\classes\com\example\model
I compiled the above java coding as below:
For Java - Compiler Option
-----------------------------
D:\MyProjects\beerV1\src>javac -classpath c:\Tomcat\common\lib\servlet-api.jar -d ..\classes \com\example\model\BeerExpert.java By above the class file for BeerExpert has been automatically placed at D:\MyProjects\beerV1\classes\com\example\model
For Servlet - Compiler Option
-----------------------------
D:\MyProjects\beerV1\src>javac -classpath c:\Tomcat\common\lib\servlet-api.jar -d ..\classes \com\example\web\BeerSelect.java When I tried to compile the Servlet by same, it's geenrating the error message as
com/example/model pacakge doesn't exists;
Why this error is occuring? How to resolve it?