• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Package Questions  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am having an issue with package organization.

I have the following directory sturcture


App ---
srcdir ---
testing.java(main is here)
connections ---
connectionFactory.java
core---
customer.java


I am trying to use cnnectionFactory in customer and customer in testing

I have the following import statements

in customer

import connections.ConnectionFactory

in testing

import core.customers

why I try to compile everything I get the following errors

src/core/setTopBox.java:5: package connections does not exist
import connections.ConnectionFactory;
^
1 error
src/testing.java:2: package core does not exist
import core.*;


I must have this set up wrong but I am not sure how. Can anyone shed some light on this for me?

Thanks
 
Marshal
Posts: 60062
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A few things you might try:-
  • You mention folders called connections and core. Check that those are exactly the packages you have declared in your source.
  • Have you compiled anything at all? If you are compiling by hand, use "javac -d . ClassName.java"
  • If you haven't got much compiled, delete everything from your folder except the source files and any other resources you need. That includes folders. Then start from scratch, in the same directory your source files are in.
  • Start with the files farthest from the main method, otherwise your complier will find unfulfilled dependencies of you start with the class with the main method.
  • Use an explorer program to check that the folder structure is the same as you think it is.

  • Anybody else got any suggestions??
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!