Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

Quick Eclipse/Java question

Thread view: 
Zerex71 - 15 Feb 2007 17:01 GMT
I am developing some test classes in Test Project 1 and want to
include them in My Application 1, however, they are separate projects
in Eclipse.  Is there any way I can link or import to tell My
Application 1, "Go to Test Project 1" and import the classes under
development?  I really want to keep the development of the two
separate right now although the classes in Test Project 1 will
eventually become part of My Application 1; I just don't want to do
that right now.

Thanks,
Mike
Corona4456 - 15 Feb 2007 17:17 GMT
Right click on "Test Project 1" and go to properties... in properties
click on "Project References".

> I am developing some test classes in Test Project 1 and want to
> include them in My Application 1, however, they are separate projects
[quoted text clipped - 7 lines]
> Thanks,
> Mike
Zerex71 - 15 Feb 2007 17:32 GMT
> Right click on "Test Project 1" and go to properties... in properties
> click on "Project References".
[quoted text clipped - 10 lines]
> > Thanks,
> > Mike

I did that and it didn't resolve my errors.
www - 15 Feb 2007 20:47 GMT
>> Right click on "Test Project 1" and go to properties... in properties
>> click on "Project References".
[quoted text clipped - 11 lines]
>
> I did that and it didn't resolve my errors.

First of all, your situation is very, very common: one Eclipse
project(say Project_A) depends on another Eclipse project(say Project_B)
and Project_B depends on another Eclipse project, Project_C .....

In your simple case, My Application 1 depends on Test Project 1, you
need to do two things:

(1)As previous replier said (but with an error, he reversed the
direction) and you already did: right click on My Application 1 and go
to Properties... in Properties click on "Project References".

I hope you didn't do the wrong direction as the first replier said.

(2)Still in Properties, click Java Build Path, add Test Project 1
It tells Eclipse to build Test Project 1 first, then build My Application 1.

Your program should work now.
Zerex71 - 16 Feb 2007 17:14 GMT
> >> Right click on "Test Project 1" and go to properties... in properties
> >> click on "Project References".
[quoted text clipped - 29 lines]
>
> Your program should work now.

Hi - thanks for the reply.  A couple of comments:

1. I did not try the second part of your suggestion.  I did try the
first however, in the correct direction.
2. My problem is that there was no way for me to do an import in the
code to just "point to" the code in the test application.
So I bit the bullet and just Refactor > Moved the test package into
the application, since that's where it's going to end up
anyway.  No big deal, but I still think as smart as Eclipse is, it
*must* know about my other class somehow if I reference it,
even if I just have to pull in an import statement.  I mean, isn't
that what I'd do for classes that weren't even projects in
my application (i.e. external package, JAR, etc.)?

Mike
www - 16 Feb 2007 18:21 GMT
>> First of all, your situation is very, very common: one Eclipse
>> project(say Project_A) depends on another Eclipse project(say Project_B)
[quoted text clipped - 29 lines]
>
> Mike

You need to do both step 1 and step 2. Both steps are required. And it
takes almost no time to set it up.

There is no need to use "import ..." statement at the top of the file.

In real world, every Eclipse project is dependent on other projects.
Rarely one Eclipse project can finish the "work" by itself. One class
needs another class which belongs to a different project. No need to put
all classes in one mega-project. Your situation is extremely simple and
extremely common.
Zerex71 - 19 Feb 2007 16:16 GMT
> >> First of all, your situation is very, very common: one Eclipse
> >> project(say Project_A) depends on another Eclipse project(say Project_B)
[quoted text clipped - 40 lines]
> all classes in one mega-project. Your situation is extremely simple and
> extremely common.

Okay, thanks, I'll try that next time.

Speaking of JARs...a while back I was working on an application and
had sort of a similar problem.
I had a "component" (generic term for a glob of stuff I required) but
could not for the life of me
determine how to get the requiring project to recognize it.  I notice
there are many import-type
functions available in Eclipse.  Is there any place that explains what
each is used for (for example,
when to link something in to a build path, when to import a JAR,
etc.)?  Does this make sense what
I'm asking for?

Mike
Lew - 16 Feb 2007 20:25 GMT
> 2. My problem is that there was no way for me to do an import in the
> code to just "point to" the code in the test application.
[quoted text clipped - 5 lines]
> that what I'd do for classes that weren't even projects in
> my application (i.e. external package, JAR, etc.)?

You could package the external classes as a JAR and include the JAR in your
application. Eclipse knows how to put JARs, either standalone or as an Eclipse
"library", into a project.

- Lew


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.