The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Cyclical dependancy

Posted by Steve White on February 14, 2002 at 3:56 PM

> Observed - The same situation may get solved in C++ by using
>forward declaration within each class. We cannot achieve the
>same in Java since we dont have the concept of diffrentiating
>header file (*.h) and source file (*.cpp).


While I agree that you should try to avoid cyclic dependancy through design, there are certainly time when it is required.

Java supports cyclic dependancies automatically, so long as the required dependant files are in your CLASSPATH.

If both files are in your current directory, be sure your current directory is part of the CLASSPATH.

Hope this helps.


Steve White




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us