*
The moose likes Servlets and the fly likes Problems with the first project of HF Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problems with the first project of HF Servlets" Watch "Problems with the first project of HF Servlets" New topic
Author

Problems with the first project of HF Servlets

Claudio Donat�
Greenhorn

Joined: Dec 02, 2006
Posts: 7
First of all, I want to say that my english is very poor, so please overlook my mistakes.

People, I'm having some problems.

I'm using Head First, Servlets ans JSP translated to brazilian portuguese.

And I am having the following problems.

This is the structure of my project:




And this is the structure of Tomcat:



In C:\Tomcat\webapps\Beer-v1\WEB-INF I have the web.xml, with the code:


Inside of F:\Meu projeto\BeerV1\src\com\example\web I have the BeerSelect.java with the code:



And inside of F:\Meu projeto\BeerV1\src\com\example\model I have the BeerExpert.java with the code:



Then, when I compile that's the message that I receive:

F:\Meu projeto\BeerV1>javac -d classes src\com\example\model\BeerExpert.java
Note: src\com\example\model\BeerExpert.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.


When I recompile whit -Xlint I recive this:


F:\Meu projeto\BeerV1>javac -Xlint -d classes src\com\example\model\BeerExpert.java
src\com\example\model\BeerExpert.java:13: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
brands.add("Jack Amber");
^
src\com\example\model\BeerExpert.java:14: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
brands.add("Red Moose");
^
src\com\example\model\BeerExpert.java:18: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
brands.add("Jail Pale");
^
src\com\example\model\BeerExpert.java:19: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
brands.add("Gout Stout");
^
4 warnings


Its possible that this is causing the problems?

Inside of F:\Meu projeto\BeerV1\classes\com\example\model and F:\Meu projeto\BeerV1\classes\com\example\web I have BeerExpert.class and BeerSelect.class, in this order.


When I compile, with de comand
javac -classpath c:/Tomcat/common/lib/servlet-api.jar -d classes src/com/example/web/BeerSelect.java
I receve this 3 errors:


src/com/example/web/BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/BeerSelect.java:20: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
src/com/example/web/BeerSelect.java:20: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();


I know it is a large code, and if anyone with a lot of patience could help me, I will be very, very thankful.


Tanks people!!!
[ December 02, 2006: Message edited by: Bear Bibeault ]
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
1. Your English is fine. Quite readable.

2. Warnings are just warnings, not errors; the classes are still compiling. Look at generics added in java 5. e.g., google search found web page talking about getting rid of similar warnings.. I could be wrong, but I would guess that HFSJ came out before java 5. Anyone?

3. with your second compile you are getting errors because your classes aren't in the classpath.
[ December 02, 2006: Message edited by: Carol Enderlin ]
Claudio Donat�
Greenhorn

Joined: Dec 02, 2006
Posts: 7
Thanks for the reply.

But, how do I put them in the classpath?

I have followed all the steps that the book told me to follow, what am I missing here?
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
HowToSetTheClasspath
Claudio Donat�
Greenhorn

Joined: Dec 02, 2006
Posts: 7
Sorry to bother you again.

I set my CLASSPATH with the command set CLASSPATH=F:\Meu projeto\BeerV1\classes\com\example

Thats the path to the .class that has the BeerExpert class.

I also put the same PATH into Control Panel>System>advanced>Environment Variables>PATH

But the same error kips showing up.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Set your classpath to F:\Meu projeto\BeerV1\src\


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with the first project of HF Servlets