• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

compiling interdependent classes and packages

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two packages, each package is dependent on the other. (Package A uses classes from package B. And package B uses classes from package A.) How can I compile each package, so they see the other dependent package? My compiler says it cannot resolve symbols since it cannot find the compiled packages.

I am using JCreator as my development environment. I don't know how to arrange the packages in directories to resolve these dependencies. Does JCreator require the .java files stored in a particular directory structure? Even classes within the same package can't see each other and I can't compile them.
 
blacksmith
Posts: 1332
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By default, Java requires that the directory structure reflect the package structure. Some tools don't enforce this, but I recommend doing it anyway.

You also have to reflect the dependencies in the import statements.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens if you just move every single source file into the same directory and then execute the following command in that directory?

javac -d . *.java

For help with JCreator, I'm moving this to the IDEs and Other Tools forum...
[ September 28, 2004: Message edited by: Dirk Schreckmann ]
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic