Unable to open XLSX file using Apache POI: NoClassDefFoundError <p>I'm having problems trying to open an XLSX file with Apache POI.</p> <p>My code:</p> <pre><code>import java.io.File; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ExcelTest { public static void main(String[] args) { try(FileInputStream f = new FileInputStream(new File("path/to/my/file.xlsx"))) { XSSFWorkbook wb = new XSSFWorkbook(f); // This is the line throwing the exception } catch(IOException e) { System.err.println(e.getMessage()); e.printStackTrace(System.err); } } } </code></pre> <p>Exception thrown:</p> <pre class="lang-none prettyprint-override"><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException at my.TEST.ExcelTest.main(ExcelTest.java:24) Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 1 more </code></pre> <p>Background:</p> <ul> <li>Running JDK 7 on MacOS X (Mavericks)</li> <li>Using NetBeans</li> <li>Imported jars (all from Apache POI binary distribution): <ul> <li><code>poi-3.11-20141221.jar</code></li> <li><code>poi-ooxml-3.11-20141221.jar</code></li> <li><code>poi-ooxml-schemas-3.11-20141221.jar</code></li> <li><code>commons-codec-1.9.jar</code></li> <li><code>log4j-1.2.17.jar</code></li> </ul></li> </ul> <p>I can't even start doing the real stuff, since I can't even open the book! :(</p> <p>When I saw the exception, I thought "Ok, let's get xmlbeans and see if it works", but xmlbeans is moved into Apache's attic.</p> <p>Am I missing something? How can I open the workbook?</p>