jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes BeerExpert.java uses unchecked or unsafe operations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "BeerExpert.java uses unchecked or unsafe operations" Watch "BeerExpert.java uses unchecked or unsafe operations" New topic

BeerExpert.java 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 BeerSelect.java 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/BeerSelect.java
src/com/example/web/BeerSelect.java:20: cannot access src.com.example.model.BeerExpert
bad class file: .\src\com\example\model\BeerExpert.java
file does not contain class src.com.example.model.BeerExpert
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 src.com.etc.etc 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: http://aspose.com/file-tools
subject: BeerExpert.java uses unchecked or unsafe operations
It's not a secret anymore!