Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » creating java project yields some.packages and some/packages
creating java project yields some.packages and some/packages [message #158662] Thu, 13 May 2004 16:34 Go to next message
Eclipse UserFriend
Originally posted by: msorens.softhome.net

(1) I am new to Eclipse (though not new to Java) and have created a new
project as a receptable for my Java code library. I set the location of
the project to be the root of my library (wherein I have packages
com.xx.yy, gnu.getopt, etc.) Most of my directories show up in the package
explorer as com.xx.yy but a few show up as com/xx/yy and are "lost" in a
sense. Take gnu.getopt, for example. It shows up as "gnu/getopt". Within
this package the Getopt.java file has a package declaration of "package
gnu.getopt;" and yet Eclipse states that the declared package does not
match the expected package. Also, references to other files cannot find
Getopt here. "Quick fix" offers to move Getopt into package "gnu.getopt",
and if I let it, then moves it to .../gnu/getopt/gnu/getopt/Getopt.java.
How do I get Eclipse to recognize Getopt.java as being in the right place??

(2) Possibly related, can someone point me to documentation that explains
about source folders on the build path, exclusion filters, and the default
output folder? I find the documentation skimpy on these points.
Re: creating java project yields some.packages and some/packages [message #158761 is a reply to message #158662] Fri, 14 May 2004 10:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.rizzoweb.com

Michael Sorens wrote:

> (1) I am new to Eclipse (though not new to Java) and have created a new
> project as a receptable for my Java code library. I set the location of
> the project to be the root of my library (wherein I have packages
> com.xx.yy, gnu.getopt, etc.) Most of my directories show up in the package
> explorer as com.xx.yy but a few show up as com/xx/yy and are "lost" in a
> sense. Take gnu.getopt, for example. It shows up as "gnu/getopt". Within
> this package the Getopt.java file has a package declaration of "package
> gnu.getopt;" and yet Eclipse states that the declared package does not
> match the expected package. Also, references to other files cannot find
> Getopt here. "Quick fix" offers to move Getopt into package "gnu.getopt",
> and if I let it, then moves it to .../gnu/getopt/gnu/getopt/Getopt.java.
> How do I get Eclipse to recognize Getopt.java as being in the right place??

Do all of your source packages (com.xx..., gnu.getopt..., etc.) have the
same root directory? IOW, are they all contained at the same place and
level?
It sounds as if you have specified the source folder for the gnu stuff
incorrectly. Here are a couple of possible layouts; which one do you have:

-- possible layout 1 ---
some-project/
src/
com/
xx/
...
gnu/
getopt/
...



-- possible layout 2 --
some-project/
src/
com/
xx/
...
third-party/
gnu/
getopt/
...



-possible layout 3 --
some-project/
src/
com/
xx/
...
get-opt-project/
gnu/
getopt/
...


For Layout 1, you would need just one source folder for your Eclipse
project, because all of the source package directories are rooted at the
same location. It would be some-project/src.

For Layout 2, you would need two source folders defined in the Eclipse
project, because the source trees for com... and gnu... are rooted at
different locations. The two source folders would be some-project/src
and some-project/third-party/

For Layout 3, you would again need to define two source folders,
some-project/src and get-opt-project/

Hopefully these examples will be close enough to your situation for you
to get your project set up correctly.


> (2) Possibly related, can someone point me to documentation that explains
> about source folders on the build path, exclusion filters, and the default
> output folder? I find the documentation skimpy on these points.

I searched the Eclipse Help for "source folder" and the first 5 or 6
matches provided pretty good help, IMO. It is not really a very complex
concept, so perhaps you're over-thinking it? Basically, source folders
are where Eclipse pulls your source package hierarchy(ies) from. They
must contain a directory hierarchy that matches the package structure of
the code (for example com/xx/... or gnu/getopt/). Exclusion filters
allow you to exclude certain branches from a defined source folder (for
example if your source hierarchy contained some code that you didn't
need/want compiled for this particular project). IME, Exclusion Filters
are only used occasionally. The default output folder is where Eclipse
will deposit the compiled .class files for your source folders (unless
you define a specific, separate output folder for a particular source
folder - a feature that allows you to, for example, to deposit the gnu
classes into a separate location than your com.xx... classes).

HTH,
Eric
Re: creating java project yields some.packages and some/packages [message #158823 is a reply to message #158761] Fri, 14 May 2004 18:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: msorens.softhome.net

Eric:
Much obliged for your taking the time for such a detailed response. I am
using what you designate as layout 1 for my code... After reading your
notes, I had a better perspective on what the source folder list was
doing. The problem arose because when I created the project I pointed it
to my existing subtree and Eclipse auto-populated the source folder list,
listing three directories, with the first containing exclusion paths that
pointed to the other two (!), plus a few other exclusion paths. My
original concept of exclusion path was apparently correct, in agreement
with yours, but I saw some folders compiled in the package explorer that I
thought should have been excluded... having the other ones in the source
folder list caused this. Whew! So I edited the source folder list to
contain just one (per your suggestion for layout 1) and then cleaned up
the exclusion path to have just the ones I did want to exclude, and I
"good to go".

Thanks again!


Eric Rizzo wrote:

> Michael Sorens wrote:

> > (1) I am new to Eclipse (though not new to Java) and have created a new
> > project as a receptable for my Java code library. I set the location of
> > the project to be the root of my library (wherein I have packages
> > com.xx.yy, gnu.getopt, etc.) Most of my directories show up in the package
> > explorer as com.xx.yy but a few show up as com/xx/yy and are "lost" in a
> > sense. Take gnu.getopt, for example. It shows up as "gnu/getopt". Within
> > this package the Getopt.java file has a package declaration of "package
> > gnu.getopt;" and yet Eclipse states that the declared package does not
> > match the expected package. Also, references to other files cannot find
> > Getopt here. "Quick fix" offers to move Getopt into package "gnu.getopt",
> > and if I let it, then moves it to .../gnu/getopt/gnu/getopt/Getopt.java.
> > How do I get Eclipse to recognize Getopt.java as being in the right place??

> Do all of your source packages (com.xx..., gnu.getopt..., etc.) have the
> same root directory? IOW, are they all contained at the same place and
> level?
> It sounds as if you have specified the source folder for the gnu stuff
> incorrectly. Here are a couple of possible layouts; which one do you have:

> -- possible layout 1 ---
> some-project/
> src/
> com/
> xx/
> ...
> gnu/
> getopt/
> ...



> -- possible layout 2 --
> some-project/
> src/
> com/
> xx/
> ...
> third-party/
> gnu/
> getopt/
> ...



> -possible layout 3 --
> some-project/
> src/
> com/
> xx/
> ...
> get-opt-project/
> gnu/
> getopt/
> ...


> For Layout 1, you would need just one source folder for your Eclipse
> project, because all of the source package directories are rooted at the
> same location. It would be some-project/src.

> For Layout 2, you would need two source folders defined in the Eclipse
> project, because the source trees for com... and gnu... are rooted at
> different locations. The two source folders would be some-project/src
> and some-project/third-party/

> For Layout 3, you would again need to define two source folders,
> some-project/src and get-opt-project/

> Hopefully these examples will be close enough to your situation for you
> to get your project set up correctly.


> > (2) Possibly related, can someone point me to documentation that explains
> > about source folders on the build path, exclusion filters, and the default
> > output folder? I find the documentation skimpy on these points.

> I searched the Eclipse Help for "source folder" and the first 5 or 6
> matches provided pretty good help, IMO. It is not really a very complex
> concept, so perhaps you're over-thinking it? Basically, source folders
> are where Eclipse pulls your source package hierarchy(ies) from. They
> must contain a directory hierarchy that matches the package structure of
> the code (for example com/xx/... or gnu/getopt/). Exclusion filters
> allow you to exclude certain branches from a defined source folder (for
> example if your source hierarchy contained some code that you didn't
> need/want compiled for this particular project). IME, Exclusion Filters
> are only used occasionally. The default output folder is where Eclipse
> will deposit the compiled .class files for your source folders (unless
> you define a specific, separate output folder for a particular source
> folder - a feature that allows you to, for example, to deposit the gnu
> classes into a separate location than your com.xx... classes).

> HTH,
> Eric
Re: creating java project yields some.packages and some/packages [message #159067 is a reply to message #158823] Mon, 17 May 2004 09:33 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse.rizzoweb.com

Michael Sorens wrote:

> Eric:
> Much obliged for your taking the time for such a detailed response.
[snip]
> So I edited the source folder list to
> contain just one (per your suggestion for layout 1) and then cleaned up
> the exclusion path to have just the ones I did want to exclude, and I
> "good to go".
>
> Thanks again!

Glad to have been of help. 90% of the time when people have "problems"
with this area of Eclipse it is just a misconfiguration of their
Project, as you saw.

Eric
Previous Topic:HELP FOR JAVASCRIPT
Next Topic:Debugger is fine but steps are not visible
Goto Forum:
  


Current Time: Fri Sep 19 08:16:54 EDT 2025

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

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

Back to the top