• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help for HFSJ - CH 3 Page 84

 
jimmy
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am doing the first web application given in the book.(HFSJ - page 84)

I am now trying to compile 'BeerExpert.java' file but i get error:
----------------------------------------------------------------------
C:\Program Files\Apache Software Foundation\Tomcat 5.5\Myprojects\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.
----------------------------------------------------------------------

But at the same time i see a correspoding class file generated for 'BeerExpert' and placed in floder 'Classes/com/example/model'.

nOW if i try compiling 'BeerSelect.java' file i get error:
----------------------------------------------------------------------
C:\Program Files\Apache Software Foundation\Tomcat 5.5\Myprojects\beerV1>javac -
d classes src/com/example/web/BeerSelect.java
src/com/example/web/BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/BeerSelect.java:18: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert bx = new BeerExpert();
^
src/com/example/web/BeerSelect.java:18: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert bx = new BeerExpert();
^
3 errors
----------------------------------------------------------------------


Please help, thanks.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your classpath is not setup properly.
Specifically, the directory that houses your packages needs to be on the classpath.

Javaranch has an excellent article on classpaths.
There is a lead-in to it in the servlets faq.
http://faq.javaranch.com/view?CompilingServlets
 
hem kumar
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Anand i got that same problem just a few days ago.

assuming u use the same directory stucture as is given that book ,u set ur classpath as follows

classpath = %classpath%;D:/MyProjects/beerv1/classes;

U make necessary changes if its isn't in 'd' drive. Hope for the best.

keep in contact with me. We are sailing in the same boat....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic