Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Between /lib and /web/WEB-INF/lib

 
andree surya
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I've been learning java web for several weeks and I always use "/web/WEB-INF/lib" as my compile classpath. Well, I don't feel right doing this, because I think that's not how "/web" directory supposed to be used. Recently, I see an example on the Internet that uses "/lib" (directly under root) as its compile classpath. However, if I do put my library (e.g. JDBC driver) under "/lib", still I have to put that library under "/web/WEB-INF/lib" for runtime usage, so the file will be redundant.

So basically my question is, where should I put external libraries?

Thanks,
Ang
 
Vijitha Kumara
Bartender
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
andree surya wrote:... So basically my question is, where should I put external libraries?

I'm not sure your are talking about building with IDE or in general. But people use different approaches in this, specially building with Ant etc.. In this case If you have put the "jars" inside the WEB-INF/lib then you can point them to the compiler too, so you don't have to have duplicates. If you are talking about any IDE like "Eclipse" then you may have some common "user libraries" setup to use in each project (which can be used config the build path).

 
andree surya
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently I'm working without IDE, and I configure the classpath manually inside the ant build file.
I set my compile classpath by including every jar files inside /web/WEB-INF/lib. So it's okay and common to do this? I don't need to create a separate /lib directory?
 
Vijitha Kumara
Bartender
Posts: 3908
9
Chrome Fedora Hibernate
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
andree surya wrote:... I don't need to create a separate /lib directory?

No. Tools like "Maven" have addressed these issues in depth by having a repository for all the artifacts locally.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64190
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An overly-complex tool like Maven is hardly necessary.

For the purpose of compilation, you can have the jar files anywhere you'd like as long as they are part of the compilation classpath.

Personally, I do put them in a /lib folder for compilation, and have the ant build copy them into WEB-INF/lib when it assembling the web application for deployment (or creation of a war file).
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33696
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I keep mine in the WEB-INF/lib folder. I agree that it's a matter of personal preference.
 
andree surya
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I think I'll go with the /lib. Thanks for the input !
 
skp Kumar
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/lib : jar file available at server level
/web/WEB-INF/lib: jar files available at application level
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic