aspose file tools*
The moose likes Beginning Java and the fly likes import package in a sibling directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "import package in a sibling directory" Watch "import package in a sibling directory" New topic
Author

import package in a sibling directory

Jim Henessey
Ranch Hand

Joined: Sep 13, 2003
Posts: 32
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

Joined: Aug 20, 2001
Posts: 1821

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 ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Jim Henessey
Ranch Hand

Joined: Sep 13, 2003
Posts: 32
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

Joined: Dec 10, 2001
Posts: 7023
Jim,
What do the relevant parts of your code look like? Could you post the basic outlines of your class definitions?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: import package in a sibling directory