I am designing a web application in Java using MVC architecture. I am using a Tomcat server. My directory structure is as follows:
Myprojects
|
amy1-------------------------
| | | | |
src lib etc web classes
| |
com com
| |
example---------- example
| | | |
web model web model
| | |
MyServlet Mymodel.java MyModel.class
.java
I have used package com.example.model
statement in MyModel.java
.
The code of MyServlet
is something like this:
package com.example.web.
import com.example.model.*;
// ...
String c = request.getParameter();
MyModel m = Mymodel(c);
I am in this directory when I use javac
:
C:\MyProjects\amy1
I execute following javac command:
javac -classpath "C:\Program Files\Tomcat 6.0\lib\servlet-api.jar" -d classes "src\com\example\MyServlet.java"
I get compiler errors saying:
1. import of package com.example.model.* failed.
2. symbol not found error on line where I create Mymodel object.
Can anyone tell me how to solve this bug? Why is the package not getting imported?