Dear members,
I am developing a Java web project. in my 'src' folder- I have the following two classes:
1)
2)
First, from my project root directory I compiled the model class:
E:\SCWCD preparation\HF Projects\javaEbook>javac -cp "C:\My Tools\apache-tomcat-
6.0.20\apache-tomcat-6.0.20\lib\servlet-api.jar" -d classes src\com\foo\model\BookExpert.java
But later when I tried to compile the controller servlet:
E:\SCWCD preparation\HF Projects\javaEbook>javac -cp "C:\My Tools\apache-tomcat-
6.0.20\apache-tomcat-6.0.20\lib\servlet-api.jar" -d classes src\com\foo\controller\BookSelectServlet.java
I got the following errors:
src\com\foo\controller\BookSelectServlet.java:8: package com.foo.model does not exist
import com.foo.model.*;
^
src\com\foo\controller\BookSelectServlet.java:25: cannot find symbol
symbol : class BookExpert
though the model class BookExpert was successfully built inside the classes/com/foo/model directory, still the controller servlet did not compile
please anyone help me out of the pain i am suffering from the last night
-
"package does not exist" error (1 messages)
- Posted by: Johnstoppable Johnny
- Posted on: May 23 2010 08:02 EDT
- package com.foo.model;
- public class BookExpert{
- //some method implementation
- }
- package com.foo.controller;
- import com.foo.model.*;
- public class BookSelectServlet extends HttpServlet{
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException{
- //calling the model class
- BookExpert be = new BookExpert();
- }
- }
Threaded Messages (1)
- "package does not exist" error by Wendy Specht on May 27 2010 13:20 EDT
-
"package does not exist" error[ Go to top ]
- Posted by: Wendy Specht
- Posted on: May 27 2010 13:20 EDT
- in response to Johnstoppable Johnny
2 things.
first, make sure that each package is in its own "folder"
second, check your path and/or classpaths to make sure that the packages are there.
Usually when I get an error like the one you are having it turns out to be some typo that I look at a hundred times and don't see. or a "phantom" error,
a "phantom" error is one that does not show up in the text but is there in the back ground, I solve them by simply retyping the offending code. More times than not, the "error" goes away.
hope this helps..... some times the problems are ths simplest ones to solve.