Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9301
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Compile Problem involving Dependencies |
| Date | 2011-10-29 17:24 +0000 |
| Organization | UK Free Software Network |
| Message-ID | <j8hcsq$nma$1@localhost.localdomain> (permalink) |
| References | <Xns9F8D860F77952jpnasty@94.75.214.39> |
On Sat, 29 Oct 2011 17:06:46 +0000, Novice wrote: > I'm having a problem compiling some Java code which I _think_ has to do > with a dependency issue that I don't fully understand. I wonder if > someone here can enlighten me? > > I have a class named FooApplet which is defined as public and extends > JApplet. FooApplet makes use of a class I wrote called WrapUtils, which > is simply a public class. WrapUtils in turn makes use of other classes I > wrote called ErrorUtils and CountUtils, both of which are simply public > classes. > > I'm using Eclipse 3.7 and FooApplet compiles just fine. However, > WrapUtils shows compile errors at every mention of ErrorUtils and > CountUtils. ErrorUtils and CountUtils both compile cleanly. > > The suggested fixes for the errors in WrapUtils include generating an > import statement for ErrorUtils and CountUtils, even though they are in > the same package as WrapUtils. When I click on the option to generate > those imports, the import statement is NOT added to WrapUtils and the > errors for ErrorUtils and CountUtils remain. The red "x" remains on > WrapUtils both in the editor and in Package Explorer. Why does Eclipse > not see the ErrorUtils and CountUtils? All of the classes are public and > all of WrapUtils, CountUtils and ErrorUtils are in the same package, > although it is a different package than the one containing FooApplet? > > So, to recap, we have: > > com.foo.FooApplet (public extends JApplet) > - invokes com.foo.utilities.WrapUtils (public) > - invokes com.foo.utilities.CountUtils (public) > - invokes com.foo.utilities.ErrorUtils (public) > > All references to CountUtils and ErrorUtils in WrapUtils are flagged as > compile errors: "CountUtils cannot be resolved". > > What stupid mistake am I making? Is this a dependency error? Or is the > fact that the methods in WrapUtils, CountUtils and ErrorUtils are all > static that are the source of the problem? You don't mention where the classes are in your directory structure or the package name of FooApplet. I would assume that, relative to where Eclipse is run you'd find that - FooApplet contains the "package com.foo;" declaration - all three other sources contain the "package com.foo.utilities;" declaration. - the path names of the .java files relative to the Eclipse root are: com/foo/FooApplet.java com/foo/utilities/WrapUtils.java com/foo/utilities/CountUtils.java com/foo/utilities/WrapUtils.java If your package declarations and relative pathnames differ, thats most likely the cause. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Compile Problem involving Dependencies Novice <novice@example..com> - 2011-10-29 17:06 +0000
Re: Compile Problem involving Dependencies markspace <-@.> - 2011-10-29 10:18 -0700
Re: Compile Problem involving Dependencies Novice <novice@example..com> - 2011-10-29 17:29 +0000
Re: Compile Problem involving Dependencies markspace <-@.> - 2011-10-29 12:32 -0700
Re: Compile Problem involving Dependencies Lew <lewbloch@gmail.com> - 2011-10-29 17:06 -0700
Re: Compile Problem involving Dependencies Roedy Green <see_website@mindprod.com.invalid> - 2011-10-30 01:28 -0700
Re: Compile Problem involving Dependencies Martin Gregorie <martin@address-in-sig.invalid> - 2011-10-29 17:24 +0000
Re: Compile Problem involving Dependencies Roedy Green <see_website@mindprod.com.invalid> - 2011-10-29 23:25 -0700
csiph-web