Setup for Java Package Development. [message #157162] |
Fri, 16 June 2006 12:57  |
Eclipse User |
|
|
|
I have a Java Package under development and residing in the following
folder:
C:\com\jPackage
The 'jPackage' .java files all reside in this folder.
I have a set of .java test classes residing in the following folder:
C:\jPackage_Test
There is a 'jPackageMain.java' file and a collection of associated test
java files.
I have been using Eclipse 2.1.3 for quite awhile now but after a power
failure it would not setup the Project properly. This event was a good
"Forcing Function" to get me to upgrade my Eclipse to version 3.1.2.
My previous setup was working but somewhat of a kludge.
The 'com.jPackage' folder was under the C:\jPackage_Test which caused me
to manually move it periodically to C:\com\jPackage for Configuration
Management and backup purposes.
The initial development was using EMacs and the above folder setup.
I went to Eclipse primarily for the "Re-factoring" support and I found the
debug usage much easier. The above 'kludge' setup was the only way I could
make Eclipse work given my previous [and I believe correct] folder setup.
Note 1:
Each .java test source has an "import com.jPackage" command and the .java
files in the C:\com\jPackage folder use the "package com.jPackage" command.
Note 2:
I have the "Java Developers Guide to Eclipse" book but it is Copy Write
2003 and
therefore out of sync with the Eclipse 3.x series. Any suggestion on a
book that is up to date?
I think that what I am trying to do should be quite common, i.e.
developing a commercial package and testing it using Eclipse.
Can anyone please point me in the right direction to understand how to
setup this Eclipse environment.
Do I need a project for the Package and another project for the test suite?
{Note that would be ideal because eventually I'd setup another project
that shall create a Java standalone App that uses my 'com.jPackage'
system.}
During development, when I make a change in the jPackage Project can I
perform a run command that rebuilds the package and executes the
'jPackage_Test' program.
Sorry for the lengthy explanation but I could not figure any other method
to ask for the help I require.
Thanks,
Jim...
|
|
|
|
|
|
Re: Setup for Java Package Development. [message #157551 is a reply to message #157497] |
Mon, 19 June 2006 16:30   |
Eclipse User |
|
|
|
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.11806 seconds