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?


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.


/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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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