Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Just a basic question

 
Anuj Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IDE specific.
Moving
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gamini Sirisena
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18092
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18092
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic