Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with the first project of HF Servlets

 
Claudio Donat�
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HowToSetTheClasspath
 
Claudio Donat�
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set your classpath to F:\Meu projeto\BeerV1\src\
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic