title: Java ClassNotFoundException with maven dependency
body: <p>I am getting <code>ClassNotFoundException</code> and <code>NoClassDefFoundError</code> exceptions when I attempt to run my application using a maven defined dependency.</p>
  
  <p>I added my maven dependency for the jar in question to my <code>pom.xml</code> file with the following declaration:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;spy&lt;/groupId&gt;
      &lt;artifactId&gt;spymemcached&lt;/artifactId&gt;
      &lt;version&gt;2.8.4&lt;/version&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>This added the relevant JAR file to my Maven Dependencies folder in Eclipse. I can access the classes in code but I get the mentioned exceptions once I run the application.</p>
  
  <p>The jar is referenced in my Java build path under Maven dependencies:</p>
  
  <p><img src="https://i.stack.imgur.com/uR5NM.jpg" alt="Java build path"></p>
  
  <p>My local maven repository is added to my classpath:</p>
  
  <p><img src="https://i.stack.imgur.com/Pb3WF.jpg" alt="screenshot"></p>
  
  <p>When I attempt to run the application, I get the following two exceptions:</p>
  
  <pre><code>java.lang.NoClassDefFoundError: Lnet/spy/memcached/MemcachedClient;
  
  java.lang.ClassNotFoundException: net.spy.memcached.MemcachedClient
  </code></pre>
  
  <p>Can anyone point me in the right direction?</p>