Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Cycle in build path
Cycle in build path [message #178601] Mon, 20 September 2004 23:26 Go to next message
Eclipse UserFriend
Originally posted by: me.BarryBurd.com

Eclipse is complaining because I have a cycle in my build path. (See the
code below.) I understand that there's a cycle, but does this mean that
certain legal Java code is illegal in Eclipse? The code compiles and runs
with javac, but Eclipse finds the structure to be objectionable. Does this
mean that some valid code can't be imported into Eclipse?
Here's the (admittedly convoluted) code:

In project Drawings:......

package com.allmycode.drawings;

import java.awt.Graphics;

public class Drawing {
protected int x = 40, y = 40, width = 40, height = 40;

public void paint(Graphics g) {
g.drawOval(x, y, width, height);
}
}

package com.allmycode.drawings;

import com.allmycode.frames.ArtFrame;

class ShowFrameWideBB {

public static void main(String args[]) {
Drawing drawing = new Drawing();
drawing.width = 100;
drawing.height = 30;

ArtFrame artFrame = new ArtFrame(drawing);
artFrame.setSize(200, 100);
artFrame.setVisible(true);
}
}

In project Frames:......

package com.allmycode.frames;

import com.allmycode.drawings.*;
import javax.swing.JFrame;
import java.awt.Graphics;

public class ArtFrame extends JFrame {
Drawing drawing;

public ArtFrame(Drawing drawing) {
this.drawing = drawing;
setTitle("Abstract Art");
setDefaultCloseOperation(EXIT_ON_CLOSE);
}

public void paint(Graphics g) {
drawing.paint(g);
}
}
Re: Cycle in build path [message #178644 is a reply to message #178601] Tue, 21 September 2004 05:27 Go to previous messageGo to next message
Eclipse UserFriend
Cycles in code are no problem. The problem are cyclic build paths - e.g.
ProjectA has ProjectB on its build path, and ProjectB has ProjectA on its
build path.

If you really need circular dependencies and don't care about possible
performance hits, you can switch the check off in Preferences > Java >
Compiler > Build Path: Set "Circular dependencies" to "Warning".

HTH
Markus

Barry Burd wrote:

> Eclipse is complaining because I have a cycle in my build path. (See the
> code below.) I understand that there's a cycle, but does this mean that
> certain legal Java code is illegal in Eclipse? The code compiles and runs
> with javac, but Eclipse finds the structure to be objectionable. Does this
> mean that some valid code can't be imported into Eclipse?
> Here's the (admittedly convoluted) code:
>
> In project Drawings:......
>
> package com.allmycode.drawings;
>
> import java.awt.Graphics;
>
> public class Drawing {
> protected int x = 40, y = 40, width = 40, height = 40;
>
> public void paint(Graphics g) {
> g.drawOval(x, y, width, height);
> }
> }
>
> package com.allmycode.drawings;
>
> import com.allmycode.frames.ArtFrame;
>
> class ShowFrameWideBB {
>
> public static void main(String args[]) {
> Drawing drawing = new Drawing();
> drawing.width = 100;
> drawing.height = 30;
>
> ArtFrame artFrame = new ArtFrame(drawing);
> artFrame.setSize(200, 100);
> artFrame.setVisible(true);
> }
> }
>
> In project Frames:......
>
> package com.allmycode.frames;
>
> import com.allmycode.drawings.*;
> import javax.swing.JFrame;
> import java.awt.Graphics;
>
> public class ArtFrame extends JFrame {
> Drawing drawing;
>
> public ArtFrame(Drawing drawing) {
> this.drawing = drawing;
> setTitle("Abstract Art");
> setDefaultCloseOperation(EXIT_ON_CLOSE);
> }
>
> public void paint(Graphics g) {
> drawing.paint(g);
> }
> }
>
>
Re: Cycle in build path [message #178692 is a reply to message #178644] Tue, 21 September 2004 10:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: me.BarryBurd.com

Thank you, Markus. I have a follow up question. On the Project Properties
sheet there's a page called Project References. I suspect that this is
related to the build path, but I can't figure out what effect checking
things Project References page has. Can you help? Thanks.
Re: Cycle in build path [message #178714 is a reply to message #178692] Tue, 21 September 2004 11:07 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

Basically for java projects ignore the "Project References." This is for
controlling non-java builders. For java projects the projects required
to compile the project are controlled through the Java Build Path
instead from the Projects tab on the build path.

--
Thanks, Rich Kulp

Previous Topic:package/subdirectory question
Next Topic:unable to view debug vars in JDK class HashMap
Goto Forum:
  


Current Time: Sun Jun 01 06:00:04 EDT 2025

Powered by FUDForum. Page generated in 0.02508 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top