Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Setup for Java Package Development.
Setup for Java Package Development. [message #157162] Fri, 16 June 2006 16:57 Go to next message
Jim Crowell is currently offline Jim CrowellFriend
Messages: 26
Registered: July 2009
Junior Member
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 #157251 is a reply to message #157162] Sat, 17 June 2006 09:18 Go to previous messageGo to next message
Nick Veys is currently offline Nick VeysFriend
Messages: 52
Registered: July 2009
Member
You can have one project with two source folders, one /src and
one /test. They can then see each other easily.

Or you can have two projects with the test project referencing the
source project (right-click the test project, select Project References,
and select the source project).

Either should work fine and are pretty common ways of doing things.

On Fri, 2006-06-16 at 16:57 +0000, JJFormInfo wrote:
> 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 #157279 is a reply to message #157251] Sat, 17 June 2006 21:27 Go to previous messageGo to next message
Jim Crowell is currently offline Jim CrowellFriend
Messages: 26
Registered: July 2009
Junior Member
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?

I know I am doing something real dumb but can not figure it out.
The above scenario is similar to what I did when I first used the 2.x
version and led me to what I called a "kludge" in my first message of this
thread.

I feel like I should go back to EMacs development where I knew what I was
doing.
In that environment both the .java and the .class files were in the
C:\com\jPackage folders but it worked and I easily made .bat files to
create my .jar files.

I like the Eclipse IDE a lot and would like to get it setup so that the
files are in the folders I think they should be in.

Any suggestions?

Regards,
Jim...
Re: Setup for Java Package Development. [message #157497 is a reply to message #157279] Mon, 19 June 2006 15:54 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Jim Crowell is currently offline Jim CrowellFriend
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...
Re: Setup for Java Package Development. [message #157585 is a reply to message #157551] Tue, 20 June 2006 00:34 Go to previous messageGo to next message
Nick Veys is currently offline Nick VeysFriend
Messages: 52
Registered: July 2009
Member
On Mon, 2006-06-19 at 20:30 +0000, Jim Crowell wrote:
> 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...

That seems like a reasonable structure to me... What is the
initialization problem? Or is it something application-specific?

Nick
Re: Setup for Java Package Development. [message #157733 is a reply to message #157585] Tue, 20 June 2006 20:34 Go to previous message
Jim Crowell is currently offline Jim CrowellFriend
Messages: 26
Registered: July 2009
Junior Member
Initialization problem was app specific in that I did not set the main
arguments list properly.

Thank for all the help.

Jim...
Previous Topic:Auto completion based on external sources
Next Topic:BIRT RCP - can not preview
Goto Forum:
  


Current Time: Fri Nov 08 23:14:38 GMT 2024

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

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

Back to the top