<p>I have an xml file ('videofaq.xml') that defines a DTD using the following DOCTYPE</p>

<pre><code>&lt;!DOCTYPE video-faq SYSTEM "videofaq.dtd"&gt;
</code></pre>

<p>I am loading the file from the classpath (from a JAR actually) at Servlet initialization time using:</p>

<pre><code>getClass().getResourceAsStream("videofaq.xml")
</code></pre>

<p>The XML is found correctly, but for the DTD in the same package, Xerces gives me a FileNotFoundException, and displays the path to the Tomcat startup script with "videofaq.dtd" appended to the end. What hints, if any, can I pass on to Xerces to make it load the DTD properly?</p>

When you do
```
```
getClass().getResourceAsStream("videofaq.xml")
```
```
It's not xerces you are calling and as such, when you give the stream to xerces, it can't know where the file is loaded from. It loads it from the application root path (which you have described).
A simple solution would be to specify the whole path in your xml file to the dtd.
Also, xerces seems to try multiple places. So you should have a look at the grammar caching mecanism or the entity resolvers (which are used in that order I think).
Xerces grammar doc:
http://xerces.apache.org/xerces2-j/faq-grammars.html
Xerces features use-entity-resolver2:
http://xerces.apache.org/xerces2-j/features.html