This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes compiling interdependent classes and packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "compiling interdependent classes and packages " Watch "compiling interdependent classes and packages " New topic

compiling interdependent classes and packages

Nedyalka Gunderson

Joined: Apr 21, 2004
Posts: 11
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.
Warren Dew
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
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.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
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 ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: compiling interdependent classes and packages
It's not a secret anymore!