Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to understand what are considered good practice things to do in Java and Tomcat environments.

1) When I run my Ant script, the compile task in ant requires the machine classpath to have settings for the location of the jars with the proper libraries. Where under the Java install directory should I put additional jars like the servlet jars or any 3rd library jars? There seems to be many variations of /jar/lib/bin directories even under the general Java install directory.

2) In Tomcat I often see 2 lib directories. 1) Under /tomcat/lib. Should I put my own application's jars in there? 2) Under /tomcat/webapps/myapp/lib/ - why would I copy over all the jars here? Is it just for being able to package the application to run anywhere and not on my machine?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

What we do is put all the jars (e.g. commons-*.jar) into /opt/java/jars and have symlinks under ../tomcat/lib that point to them.

share|improve this answer

/tomcat/lib is where you want to put globally shared jars. Anything application specific you'll want to put in webapps// where is defined in your web.xml file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.