File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

adding external jars to a project in eclipse

 
sandeep raj
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently using eclipse for my java project development. I wanted to know if there was a way to add external jars to all the java projects (including any new ones i might create in the future) directly in eclipse. I am aware of going through the project properties -> buildpath->add external jars for individual projects but is there a way i can do it for all the projects. I was hoping to find it under window -> preferences ->build path but was unable to find anything. Anyone knows if its possible?

edit: i guess i should have posted this question in the IDE section but i couldnt delete the topic so sorry about that ..
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't think it is possible for every project in one stage. Remember it is likely that different projects will require different resources.

I shall move this thread to where we usually discuss IDEs.
 
Dawn Charangat
Ranch Hand
Posts: 249
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..,

Another way of doing this is to create a dummy project whih will hold all your jars, and you just add this dummy project in the classpath of your project.
But remember that eclipse [from 3.0] makes use of the OSGi container concepts.... hence until and unless you specify the jar, and its version usually
explicitly, it will not pick up the jar from its location. That is a standard feature of OSGi.

cheers,
Dawn
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I sometimes have a "lib" project that contains external jars. I don't have as many of them as I used to, however, since I use Maven a lot now.

There are some cases, however, where I find it better to go all the way back to the source. For example, I need the J2EE api jars from tomcat. For that, I define an external library. The Java/Build Path/User Libraries preferences allows me to create a TOMCAT user library and indicate the jars I want, giving their original locations in TOMCAT_HOME/lib. I can then reference that library in individual projects.

There are 2 benefits to that.

1. If I install a new version of Tomcat, I can change the user library and all projects will automatically pick up on it.

2. The ".classfile" will use the symbolic definition instead of absolute filesystem location. So it I check a project into CVS or Subversion and someone else checks it out, they can set up their own definition of the tomcat user library using whatever directory setup their particular machine happens to have.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic