• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question on Packages from Kathy Sierra Book

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Maulin.
Thanks for your help. I used your steps 4 and 5 to compile and it worked.
Thanks Again
Emad
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic