*
The moose likes Beginning Java and the fly likes Head First Servlets & JSP - Chapter 3, servlet version 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Head First Servlets & JSP - Chapter 3, servlet version 2" Watch "Head First Servlets & JSP - Chapter 3, servlet version 2" New topic
Author

Head First Servlets & JSP - Chapter 3, servlet version 2

John Freshman
Greenhorn

Joined: Jun 19, 2005
Posts: 12
If someone has read this book or has prior info which might get me back on track, I would really appreciate it.

I am getting a
package com.example.model does not exist
error and yet I have followed the book instruction to a tee (code, directories, etc). I am wondering if the book may be in error since the import statement points to a directory that contains only a java file instead of a class file (as shown below). As instructed by the book, the class file, which the import statement points to, is not in the
src\com\example\model
directory -- rather it is in the
classes\com\examples\model
directory (right where the -d command SHOULD put it).

Below is the directory structure and the servlet code

DIRECTORY STRUCTURE:
beerV1
---src
------com
---------example
------------web
---------------BeerSelect.java

------------model
---------------BeerExpert.java

---classes
------com
---------example
------------web

------------model
---------------BeerExpert.class


SERVLET CODE (as instructed by book):


Thanks in advance for your help.
John Freshman
Greenhorn

Joined: Jun 19, 2005
Posts: 12
I am sorry, my post has a typo. The
classes\com\examples\model
should be
classes\com\example\model


The 'example' reference is singular, not plural.
John Freshman
Greenhorn

Joined: Jun 19, 2005
Posts: 12
I stand corrected:

I was missing the all important ";classes;" in my -classpath statement.

Since the examples in the book are shown using a MAC (which uses Unix, hence forward directory slashes), I assumed the :classes: statement was foreign to Windows and would not work in Windows.

I'll never doubt again
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Head First Servlets & JSP - Chapter 3, servlet version 2
 
Similar Threads
Head First Servlet : Beer Version 2 Problem
Unable to compile servlet with model class reference
Problem in compiling this code
can't import own model
package com.example.model.* does not exist ERROR head first servlets