• 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

import package in a sibling directory

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have a main app which uses two packages: CustomerDataClass and AccountManipulationClass. Both are imported in the main file TabbedPaneApp. There are no problems there. However, AccountManipulationClass also uses CustomerDataClass and imports it.
The folder structure is TabbedPaneApp.java in root. Below this is the BankUtilities containing CustomerDataClass and AccountManipulationClass folders with the appropriate packages.
When I use either "import BankUtilities.CustomerDataClass.*;" or "import CustomerDataClass"; I get a "package CustomerDataClass does not exist".
Any ideas?
Thanks.
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Jim!
The form you want is:

OR

The format

is telling the compiler to look for the package structure /BankUtilities/CustomerDataClass/*
(Note that this will not necewssarily be true in Java 1.5, but it still will not have the effect you want; the above will import all static members of the CustomerDataClass in Java 1.5, but not the class itself)
BTW, it is general practice to have package names be entirely lowercase; e.g., "bankutilities" instead of "BankUtilities"
[ September 14, 2003: Message edited by: Joel McNary ]
 
Jim Henessey
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I really want this solution to work - but it doesn't look like it.
I change the line to BankUtilities.CustomerDataClass and I get a "cannot resolve symbol" in reference to the CustomerDataClass.
Any ideas?
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jim,
What do the relevant parts of your code look like? Could you post the basic outlines of your class definitions?
reply
    Bookmark Topic Watch Topic
  • New Topic