This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question on Packages from Kathy Sierra Book Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question on Packages from Kathy Sierra Book" Watch "Question on Packages from Kathy Sierra Book" New topic

Question on Packages from Kathy Sierra Book

Emad Salahuddin

Joined: Dec 10, 2002
Posts: 6
This is in regards to pg 63 of Kathy Sierra Book.
I have created a class Beverage in package cert.
package cert;
class Beverage {}
I have class Tea that extends class Beverage in exam.stuff package.
package exam.stuff;
import cert.Beverage;
class Tea extends Beverage{}
Both packages are in my D:\ drive.
The problem is that I don't get the following error: Can't access class cert.Beverage....(As stated in the book)
Instead I get the following: package cert does not exist
import cert.*;
^ cannot resolve symbol
symbol : class Beverage
location: class exam.stuff.Tea
class Tea extends Beverage{}
2 errors
What is it that I am doing wrong? Even when I make the Beverage class public I get the same errors.
When both classes are in the same package they compile fine.
Any help will be greatly appreciated.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
hi Emad
please see if u follow the steps i would follow if i were u...
1. make sure i have,
- d:\cert\
- d:\exam\stuff\
2. i go to ,
3. make sure i have "." (current directory) in the CLASSPATH env variable. if u don't have it u can compile like following step...
4. javac -classpath %CLASSPATH%;. cert\*.java
5. javac -classpath %CLASSPATH%;. exam\stuff\*.java
can u try that and let us know if u face more problems?
Emad Salahuddin

Joined: Dec 10, 2002
Posts: 6
Hello Maulin.
Thanks for your help. I used your steps 4 and 5 to compile and it worked.
Thanks Again
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Question on Packages from Kathy Sierra Book
jQuery in Action, 3rd edition