title: Where should I put external JAR files when developing a web app?
body: <p>I'm developing a dynamic web application with Java (Servlets/JSP) in Eclipse. I'm trying to use an external JAR (I'm using <code>StringUtils</code> from Apache Commons) and I'm confused as to where I should put the jar (<code>/lib</code>, <code>/WEB-INF/lib</code>?) and how do I need to configure my class path (in Eclipse).  </p>
  
  <p>I tried putting the JARs in both of the aforementioned places, and loading them to the classpath by clicking <code>Add JAR</code> in the project properties and both solution compile fine, but give a runtime error like so:</p>
  
  <blockquote>
    <p>SEVERE: Servlet.service() for servlet UserList threw exception
    java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
        at cs236369.hw5.db.MySqlDbHandler.insert(MySqlDbHandler.java:58)
        at cs236369.hw5.servlets.UserList.doGet(UserList.java:50)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Unknown Source)</p>
  </blockquote>
  
  <p>So... how do I load external JARs?</p>
  
  <p>Please take note that I am not that familiar with how external JARs are loaded in Java, the VM, or how Eclipse manages it all, so I would appreciate detailed solutions.</p>