title: How to add JAR libraries to WAR project without facing java.lang.ClassNotFoundException? Classpath vs Build Path vs /WEB-INF/lib
body: <p>How should I add JAR libraries to a WAR project in Eclipse without facing <code>java.lang.ClassNotFoundException</code> or <code>java.lang.NoClassDefFoundError</code>?</p>
  
  <p>The <code>CLASSPATH</code> environment variable does not seem to work. In some cases we add JAR files to the <em>Build Path</em> property of Eclipse project to make the code compile. We sometimes need to put JAR files inside <code>/WEB-INF/lib</code> folder of the Java EE web application to make the code to run on classes inside that JAR.</p>
  
  <p>I do not exactly understand why <code>CLASSPATH</code> does not work and in which cases we should add JARs to <em>Build Path</em> and when exactly those JARs should be placed in <code>/WEB-INF/lib</code>.</p>