Question: I have the following code

```
try {
   xpathInstance = XPath.newInstance(xpathExpr);
       list = (Text) xpathInstance.selectSingleNode(doc);
} catch (JDOMException e) {
   throw new Exception(e);
}

```

I had forgotten to include a library that was a dependency of the jdom.jar library. When i run the application i saw this error. 

```
Exception in thread "main" java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.jdom.xpath.XPath.newInstance(XPath.java:134)
at com.myapp.parser.GenericXMLParser.getSingleNodeValue(GenericXMLParser.java:63)

```

According to the JDOM documentation, the newInsance() method throws a JDOMEXCeption so shouldnt it have caught the error? 

Also, how can i avoid having to add a catch(Exception e) clause to avoid unknown exceptions. 

Thanks

Answer: 
This exception is not raised by the constructor. It's raised by the class loader. When it tries to load your class long before the constructor runs, the class was not found and this exception (No Class Defination Found Error) was raised which you have not handled (BTW errors can't be handled).
It wasn't caught because it wasn't thrown. The exception thrown was a `java.lang.NoClassDefFoundError`

And if you want to catch an Exception, you have to catch it. There is nothing you can do to avoid this, that would kind of defeat the whole point of exceptions.