aspose file tools*
The moose likes Servlets and the fly likes help for HFSJ - CH 3 Page 84 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "help for HFSJ - CH 3 Page 84" Watch "help for HFSJ - CH 3 Page 84" New topic
Author

help for HFSJ - CH 3 Page 84

jimmy
Greenhorn

Joined: Sep 01, 2004
Posts: 17
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

Joined: Dec 11, 2004
Posts: 13410

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


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
hem kumar
Ranch Hand

Joined: Sep 05, 2005
Posts: 97
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....


.....For Every Problem There Is a Solution.....
Regards, Hem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help for HFSJ - CH 3 Page 84
 
Similar Threads
problem while compiling
unable to compile ,, says Recompile with -Xlint
help for HFSJ - CH 3 Page 84
Problem in compiling this code
HF Servlet and Java - MVC tutorial