title: tomcat 8, how to access external java jar library files
body: <p>I am using tomcat 8 and have an external library directory called /opt/thirdParty. I have the third party library in this directory. (ie. the library directory is outside of tomcat server)</p>
  
  <p>and have context.xml under META-INF configured like this </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context&gt;
      &lt;Resources className="externalPackage.ExteranlJavaClass"&gt;
          &lt;PreResources className="externalPackage.ExteranlJavaClass"
              base="/opt/thirdParty/firstWebApp.jar"
              internalPath="/"
              webAppMount="/WEB-INF/lib" /&gt;
      &lt;/Resources&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>when I start the tomcat server and get error in the catalina.out file</p>
  
  <p>java.lang.ClassNotFoundException: externalPackage.ExteranlJavaClass</p>
  
  <p>I need help on how to configure the tomcat server so that I can access the external library files at /opt/thirdParty directory.</p>
  
  <p>Thanks.</p>
  
  <p>I also tried following and get the same error message: java.lang.ClassNotFoundException: externalPackage.ExteranlJavaClass thanks for help </p>
  
  <pre><code>&lt;Context&gt; &lt;Loader className="externalPackage.ExteranlJavaClass" 
    virtualClasspath="/opt/thirdParty/firstWebApp.jar"/&gt; &lt;JarScanner     
    scanAllDirectories="true" /&gt; 
  &lt;/Context&gt;
  </code></pre>