title: Xerces-for-Android NoClassDefFoundError When Using Jar Instead of Source Code
body: <p>I'm working with Xerces-for-Android: <a href="https://code.google.com/p/xerces-for-android/" rel="nofollow">https://code.google.com/p/xerces-for-android/</a></p>
  
  <p>If I copy the source code into a simple test project (java project, not android project), I can run my xml validator tests without any issues. </p>
  
  <p>When I make a jar from the source files then use that in my class path instead of the source, I get <code>NoClassDefFoundError</code> despite the files being present in the jar. </p>
  
  <p>Below is the error message:</p>
  
  <pre><code>java.lang.ExceptionInInitializerError
      at mf.org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
      at mf.org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
      at mf.org.apache.xerces.impl.xs.XMLSchemaLoader.reset(Unknown Source)
      at mf.org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
      at mf.org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
      at mf.org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
      at mf.javax.xml.validation.SchemaFactory.newSchema(Unknown Source)
      at xml.MFXMLUtil.validate(MFXMLUtil.java:33)
      at xml.MFXMLTester.main(MFXMLTester.java:8)
  Caused by: java.lang.RuntimeException: internal error
      at mf.org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl.applyFacets1(Unknown Source)
      at mf.org.apache.xerces.impl.dv.xs.BaseSchemaDVFactory.createBuiltInTypes(Unknown Source)
      at mf.org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.createBuiltInTypes(Unknown Source)
      at mf.org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.&lt;clinit&gt;(Unknown Source)
      ... 9 more
  </code></pre>
  
  <p>Below is my ant script to make the jar:</p>
  
  <pre><code>&lt;project name="XercesForAndroid" default="dist" basedir="."&gt;
      &lt;description&gt;
          Builds jar for Xerces-For-Android
      &lt;/description&gt;
    &lt;!-- set global properties for this build --&gt;
    &lt;property name="src" location="src"/&gt;
    &lt;property name="build" location="build"/&gt;
    &lt;property name="dist"  location="dist"/&gt;
  
    &lt;target name="init"&gt;
      &lt;!-- Create the build directory structure used by compile --&gt;
      &lt;mkdir dir="${build}"/&gt;
    &lt;/target&gt;
  
    &lt;target name="compile" depends="clean, init" description="compile the source " &gt;
      &lt;!-- Compile the java code from ${src} into ${build} --&gt;
      &lt;javac verbose="true" target="1.6" srcdir="${src}" destdir="${build}"/&gt;
    &lt;/target&gt;
  
    &lt;target name="dist" depends="compile"
          description="generate the distribution" &gt;
      &lt;!-- Create the distribution directory --&gt;
      &lt;mkdir dir="${dist}/lib"/&gt;
  
      &lt;!-- Put everything in ${build} into the .jar file --&gt;
      &lt;jar jarfile="${dist}/lib/Xerces-For-Android.jar" basedir="${build}"/&gt;
    &lt;/target&gt;
  
    &lt;target name="clean"
          description="clean up" &gt;
      &lt;!-- Delete the ${build} and ${dist} directory trees --&gt;
      &lt;delete dir="${build}"/&gt;
      &lt;delete dir="${dist}"/&gt;
    &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>The class files exist in the jar. Do I need to do anything special in the manifest, or am I missing something obvious?</p>