|
|
|
Re: Setup for Java Package Development. [message #157497 is a reply to message #157279] |
Mon, 19 June 2006 15:54 |
Eclipse User |
|
|
|
Originally posted by: eclipse4.rizzoweb.com
Jim Crowell wrote:
> Nick,
>
> I tried setting up 2 Projects [jPackageTest and jPackage] and then in
> the jBuildPath of the jPackageTest Project placing a reference to the
> jPackage Project.
>
> That may be the way to go but before that will work I have to resolve a
> problem with the jPackage setup.
>
> I have the jPackage .java files in the C;\com\jPackage folder.
> I first setup the Eclipse 'jPackage' Project such that the .project file
> is in the C:\com.jPackage folder.
> When I run jPackageTest I get errors in the import statements for
> "com.jPackage".
>
> Next I named the project "com.jPackage" and setup the Eclipse Project
> such that the .project file is in the C:\com folder.
>
> Same problem?
First recommendation: open the Eclipse Help and navigate to Java
Development User Guide > Getting Started. There is an excellent tutorial
on project organization and set-up that will help you a great deal.
You're mixing the notions of source folder and project folder. An
Eclipse Project folder contains the .project and .classpath files, and
possibly other folders that you create. A common way to set up a project
is to put your source folders under the Project root location. So, a
typical project would be like:
MyProject/
build/
<this is your build output location,
where .class files get written>
source/
com/
somepackage/
A.java
...etc...
someotherpackage/
B.java
...etc...
The project is rooted at MyProject, and the source and build (and other)
directories are contained underneath that.
Your mistake appears to be that you are trying to root the project
inside one of the package directories, which isn't going to work. You
must have a source tree under the project root that follows your package
structure.
Hope this helps,
Eric
|
|
|
Re: Setup for Java Package Development. [message #157551 is a reply to message #157497] |
Mon, 19 June 2006 20:30 |
Jim Crowell Messages: 26 Registered: July 2009 |
Junior Member |
|
|
Eric,
> First recommendation: open the Eclipse Help and navigate to Java
> Development User Guide > Getting Started. There is an excellent
> tutorial on project organization and set-up that will help you a great
> deal.
I read this again and it made more sense to me after reading your text
below.
> You're mixing the notions of source folder and project folder.
> An Eclipse Project folder contains the .project and .classpath files,
> and possibly other folders that you create. A common way to set up a
> project is to put your source folders under the Project root location.
> So, a typical project would be like:
> MyProject/
> build/
> <this is your build output location,
> where .class files get written>
> source/
> com/
> somepackage/
> A.java
> ...etc...
> someotherpackage/
> B.java
> ...etc...
>
> The project is rooted at MyProject, and the source and build (and
> other) directories are contained underneath that.
>
> Your mistake appears to be that you are trying to root the project
> inside one of the package directories, which isn't going to work. You
> must have a source tree under the project root that follows your
> package structure.
As I was going to the latest Eclipse I decided to take the time to set
my Projects up so they made sense to me coming from an EMacs "run from the
Java console" environment originally. Being pigheaded, I could not believe
that Eclipse would require me to have the source files hosted within the
Project environment.
Your above statement finally got through to me.
The Java package under development is designed to produce stand-alone Java
Apps. Therefore I also wanted an Eclipse Projects setup such that I can
isolate the package and add projects that use the Package. The first such
Project being my Test Suite. Subsequent Projects shall be various
Stand-Alone apps based on 'myPackage'.
There I setup my projects, using your guidelines, as follows:
> MyProjects/
> myPackage/
> build/
> <this is your build output location,
> where .class files get written>
> source/
> com/
> myPackage/
> A.java
> ...etc...
> myPackageTest/
> build/
> <this is your build output location,
> where .class files get written>
> source/
> B.java
> C.java
> ...etc...
> my1stApp/
> build/
> <this is your build output location,
> where .class files get written>
> source/
> D.java
> E.java
> ...etc...
> where 'myPackageTest' and 'my1stApp' points to 'myProject' in their
respective Java Build Path 'Projects' TAB...
I have Projects 'myPackage' and 'myPackageTest' setup and everything
builds nicely. I currently have an initialization problem that I have to
debug first but "Progress" has been made.
Question:
Do you see any problems with the above setup?
Many thanks for the help.
Jim...
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05906 seconds