aspose file tools*
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
Author

Question on Packages from Kathy Sierra Book

Emad Salahuddin
Greenhorn

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: Tea.java:1: Can't access class cert.Beverage....(As stated in the book)
Instead I get the following:
Tea.java:3: package cert does not exist
import cert.*;
^
Tea.java:5: 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: 1871
hi Emad
please see if u follow the steps i would follow if i were u...
1. make sure i have,
- d:\cert\Beverage.java
- d:\exam\stuff\Tea.java
2. i go to ,
d:
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?
regards
maulin
Emad Salahuddin
Greenhorn

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
Emad
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on Packages from Kathy Sierra Book