aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse build source folders / class path folders Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse build source folders / class path folders " Watch "Eclipse build source folders / class path folders " New topic
Author

Eclipse build source folders / class path folders

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Hi guys : I always notice that in eclipse there are all these options, for example, "add Library", which I never utilize. How do "add Library" and "add Class Folder" differ ? And why are they used in builds ? Generally I stick with default projects, but more and more, Im starting to work on projects where ant/maven configurations, in spite of the excellent plugin support, sometimes have to be "massaged" into eclipse, and often the utilization of these features is necessary to compile industrial grade applications in the IDE.....
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 560
I have used "add library" several times to add 3rd-party libraries, most recently the Apache Jakarta Project's Commons-BeanUtils library. I typically use the "Add Jar" button (I think it's called) to add the library's jar file to my project.

I've never used "add Class Folder," don't even remember seeing it, but I would guess from the name that it is different than adding a library. You might try the online Eclipse User Manual for insight.


Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
Thanks... I'm wondering how this relates to java builds in general though.... I can usually get eclipse to "work" by hacking it.... But I want to understand what it's doing at a more fundamental level.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

With Maven projects, use the m2eclipse plugin. Then when you load the Maven project into Eclipse (or create a Maven Project directly in Eclipse), the m2eclipse plugin will automatically sync the dependency list in your pom.xml with the list of JARs in the Eclipse build path.

With Ant project, you will have to manually add any dependencies in your Ant build to the Eclipse build path, otherwise Eclipse will not know about them and you will have to deal with a lot of red underlines and, even worse, non-functioning command completion.

And whether you do "add class folder" or "add jar", the result is that the item is added to the classpath when the compiler is run. In addition, the classes are examined to provide command completion.


JBoss In Action
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
"And whether is is "add class folder" or "add jar", the result is that the item is added to the classpath when the compiler is run. "

Can you elaborate on this? I'm not sure how eclipse compiles classes if you are using ant... Whats confusing is how it is that the eclipse is able to "use" the resources created by ant...? And more interesting, how those resources are intermingled with the niceties of the IDE like code-completion.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

I rephrased the text, hopefully that is clearer.

As far as I know, Eclipse doesn't use the information in the Ant script to populate the build path. You have to do that manually, Which means that when adding a JAR to the build you need to add it twice - once to the Ant script and once to Eclipse. But it has been a while since I did projects that use Ant, so perhaps is the 2 or 3 years since then things might have improved.
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
So what do eclipse "builders" do ? (Attached a screenshot here....) Note that you can use the "ant" builder.... you can check it , or un check it. I usually leave it unchecked. But sometimes checking it helps to fix things for me.


[Download a.tiff] Download

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

Builders are things that are run when you click the Build button or menu option. The builders are run in the order in which they appear for the project. You can choose to use a Java builder, an Ant builder, or any number of other builders, either by themselves or in combination.
jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
thats interesting. I guess that means that builders could potentially overwrite each others work . seems like a dangerous feature to implement.

In any case, I find that activating multiple builders (java and ant) , and then switching back to one (java) fixes issues. Maybe because ant needs to "set some things up" before the regular java builds will work....
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

Yes, that is correct, Builder do whatever it is that they do. And having them conflict with each other is a possibility. That is always a potential problem when you have a framework that enables plugins.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse build source folders / class path folders