File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes uses unchecked or unsafe operations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark " uses unchecked or unsafe operations" Watch " uses unchecked or unsafe operations" New topic
Author uses unchecked or unsafe operations

vishwak rajgopalan

Joined: Nov 19, 2003
Posts: 8
I am not sure whether this is the appropriate forum to post this. Please excuse me if I have made an error. I have been using HeadFirst Servlets and JSP and I compiled the code (the second version of the controller servlet).
I get the following error message saying that the package com.example.model does not exist. Please help me as I am unsure how to proceed with debugging this issue. I have pasted the error message below

D:\MyProjects\beerV1>javac -d classes src/com/example/web/
src/com/example/web/ cannot access
bad class file: .\src\com\example\model\
file does not contain class
Please remove or make sure it appears in the correct subdirectory of the classpath.
BeerExpert be = new BeerExpert();

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Just make sure your pacakge name matches the directory structure that the file is in and that your filename matches the class name of your class's signature.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Looks like you're compiling it as rather than com.etc.etc, as below. Not a stupid question, we've had this question a couple of times so I'll point it out to Bert and Kathy, maybe they can look at polishing these instructions in the next edition!

I agree. Here's the link:
subject: uses unchecked or unsafe operations
It's not a secret anymore!