Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

import package in a sibling directory

 
Jim Henessey
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • 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.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic