• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can I control the organization of my code and still use Eclipse?

 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have several apps that I have in Eclipse.

1. If I put the apps into the same project, I can re-use code from the application framework that I have developed, but this seems un-organized. For example, when I look at "Problems" I see all problems from the whole workspace which is not what I want when I'm focusing on one project-at-a-time.

2. If I put the code into different projects in the same workspace, then I can't reuse my reusable code since each project has it's own "src" directory and each project even has its own "com" folder.

3. There is a problem in seeing problems in other projects, other than the one I'm developing. I've tried using a workspace for each project. This succeeds in separating the errors so that I only see the errors from the project that I'm working on, but then I'm even farther away from being able to reuse my reusable code.

4. Another problem: to deploy a .jar file is not easy for me in Eclipse. It seems that I get it working once and have to figure it out again the next time because my choices from the previous time that I created a .jar don't "stick".

At the "Trail Ride" and in the "SCJP" forum, they suggest not using any IDE and instead use Java. They say that we should learn to use Java and that if you use an IDE, you're leanring the IDE and not learning Java.

Kaydell
[ June 29, 2007: Message edited by: Kaydell Leavitt ]
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) Why would you want everything in the same project? You could use the filter approach in #3 to see the errors for each folder/app, but as you point out it is unorganized. You would have to create multiple source folders for each app for this to work.

2) Why can't you put the code into different projects? You can add the reused code project to the build path of the reuser's project.

3) On the problems pane, there is an arrow icon for filters. If you set your filter to the active item and it's children, you limit what you see in the problems tab. By clicking on a project, you only see the errors for one project at a time.

4) You could use Ant to create the jar (with your settings) and run it whenever you want to create a jar.
 
Kaydell Leavitt
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help again Jeanne,

I remember that you've helped me before.

I'm going to try to ease-up.

Kaydell
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kaydell Leavitt:
4. Another problem: to deploy a .jar file is not easy for me in Eclipse. It seems that I get it working once and have to figure it out again the next time because my choices from the previous time that I created a .jar don't "stick".



Somewhere in the wizard - if I remember correctly, on the bottom of the last page - there is an option to save the setting in a jardesc file. Use that, and next time just right click that file and choose the option to directly create the jar file again.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's true - if you're just learning Java, learning an IDE is just making your work twice as hard. However, if you're required to use Eclipse by an employer or are proficient with Java and want the convenience features that an IDE provides, that's another matter.

If multiple projects are sharing code, you can make a project out of the shared code, have it build a jar, then have the other projects reference that jar. If everything's in the same workspace, you can define the other projects as dependent projects, so that they will be updated if you modify the jar. Also, the jar location will be made relative.

A jar defined this way is attached to the other projects for reference purposes, but presumably - OK, commonly, though not always - when those projects are deployed, they'll want their own copy of the jar. If that's the case, you have to ensure that the dependent project's build process includes a step to insert a copy of the jar into the dependent project build. I normally have Ant do that, but there are other ways as well.
reply
    Bookmark Topic Watch Topic
  • New Topic