aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Just a basic question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Just a basic question" Watch "Just a basic question" New topic
Author

Just a basic question

Anuj Singh
Ranch Hand

Joined: May 04, 2007
Posts: 47
Suppose I am developeing a Java EE web application in eclipse.Now I wan to use use struts framework and hibernate as well.So I have downloaded the jars of both the frameworks.Now,where and how will I put the JAR files in my eclipse project if I want to use those JARS?


SJCP 1.5 with 93%.Preparing for WCD
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

IDE specific.
Moving


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

where and how will I put the JAR files in my eclipse project if I want to use those JARS?


Right click on the project --> properties-->Java Build Path and you can add those jars separately or as a library.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 350
If you want to bundle those jars with your project,

Right click on the project --> properties-->Java Build Path and under the libraries tab click on "add class folder"

A common name to give this folder would be lib.

Then right click again on the project, click on Import, select General -> File System and click next. Then import the jars to your class folder.

Then again from project --> properties-->Java Build Path add the jars to the project.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

Gamini Sirisena wrote:If you want to bundle those jars with your project,

Right click on the project --> properties-->Java Build Path and under the libraries tab click on "add class folder"

A common name to give this folder would be lib.

Then right click again on the project, click on Import, select General -> File System and click next. Then import the jars to your class folder.

Then again from project --> properties-->Java Build Path add the jars to the project.


What you have said is to add a class folder to the build path. But if you want to add jars as a library you should go through Add Library and create a User Library and add that to the build path.
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 350
Yes Vijitha you seem to be correct.

I just wanted to show a way to easily bundle jars (thereafter added as jars or user defined library) with the project.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

I normally use a "lib" directory as well. Although since these days I usually use Maven, I don't actually keep copies of standard libraries like struts.jar in the project itself - I let Maven pull them into the build as needed.


Customer surveys are for companies who didn't pay proper attention to begin with.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

Tim Holloway wrote:I normally use a "lib" directory as well. Although since these days I usually use Maven, I don't actually keep copies of standard libraries like struts.jar in the project itself - I let Maven pull them into the build as needed.


Yes. I also do the same with ant . But if we are using custom builder ( i.e: by removing the default from eclipse) like ant then to get the Java doc info when coding inside the eclipse we should add those to build path from somewhere, Or eclipse will show all sorts of errors .
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Vijitha Kumara wrote:
Tim Holloway wrote:I normally use a "lib" directory as well. Although since these days I usually use Maven, I don't actually keep copies of standard libraries like struts.jar in the project itself - I let Maven pull them into the build as needed.


Yes. I also do the same with ant . But if we are using custom builder ( i.e: by removing the default from eclipse) like ant then to get the Java doc info when coding inside the eclipse we should add those to build path from somewhere, Or eclipse will show all sorts of errors .


I don't know if I understood that. Both Ant and Maven integrate well with Eclipse, including the JavaDoc stuff. However, if you mean something like having Ant pull libraries from outside the project, another strategy I've used is to have a separate "lib" project to hold these shared objects, then I add references to that project's resources from the project that's actually being built. In Maven's case, the Maven Eclipse plugin can automatically resolve back to the local repository, so it's much the same effect, just with a little extra internal support being provided.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Just a basic question