Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Package Questions  RSS feed

 
Andrew Nisbet
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
 
Campbell Ritchie
Marshal
Posts: 55678
161
  • 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??
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!