title: Java program running on build but not in a fat jar
body: <p>I have a java application that uses the Jasper Reports API to generate a PDF. It builds fine but I had to add in some fonts via Netbeans/iReport plugin in order for them to show up when exporting the PDF. On clean and build it's fine and everything works. </p>
  
  <p>But when I build a fat jar (via a few package-for-store lines in the build.xml) the reports won't run. Running via the Terminal, I get this error (sorry for wall of text):</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
      at net.sf.jasperreports.engine.fill.JRBaseFiller.&lt;init&gt;(JRBaseFiller.java:124)
      at net.sf.jasperreports.engine.fill.JRVerticalFiller.&lt;init&gt;(JRVerticalFiller.java:89)
      at net.sf.jasperreports.engine.fill.JRVerticalFiller.&lt;init&gt;(JRVerticalFiller.java:104)
      at net.sf.jasperreports.engine.fill.JRVerticalFiller.&lt;init&gt;(JRVerticalFiller.java:62)
      at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:179)
      at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:108)
      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:668)
      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:649)
      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:971)
      at ie.orderofmalta.OMFinancialsForm.yTDReportBtnActionPerformed(OMFinancialsForm.java:283)
      at ie.orderofmalta.OMFinancialsForm.access$700(OMFinancialsForm.java:30)
      at ie.orderofmalta.OMFinancialsForm$8.actionPerformed(OMFinancialsForm.java:163)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
      at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
      at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
      at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
      at java.awt.Component.processMouseEvent(Component.java:6505)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
      at java.awt.Component.processEvent(Component.java:6270)
      at java.awt.Container.processEvent(Container.java:2229)
      at java.awt.Component.dispatchEventImpl(Component.java:4861)
      at java.awt.Container.dispatchEventImpl(Container.java:2287)
      at java.awt.Component.dispatchEvent(Component.java:4687)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
      at java.awt.Container.dispatchEventImpl(Container.java:2273)
      at java.awt.Window.dispatchEventImpl(Window.java:2719)
      at java.awt.Component.dispatchEvent(Component.java:4687)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
      at java.awt.EventQueue.access$200(EventQueue.java:103)
      at java.awt.EventQueue$3.run(EventQueue.java:694)
      at java.awt.EventQueue$3.run(EventQueue.java:692)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
      at java.awt.EventQueue$4.run(EventQueue.java:708)
      at java.awt.EventQueue$4.run(EventQueue.java:706)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
  Caused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Input stream not found at : fonts/fontsfamily1406301744789.xml
      at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:188)
      at net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.getExtensions(FontExtensionsRegistry.java:56)
      at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensions(DefaultExtensionsRegistry.java:110)
      at net.sf.jasperreports.engine.util.JRStyledTextParser.&lt;clinit&gt;(JRStyledTextParser.java:83)
      ... 50 more
  Caused by: net.sf.jasperreports.engine.JRException: Input stream not found at : fonts/fontsfamily1406301744789.xml
      at net.sf.jasperreports.repo.RepositoryUtil.getInputStreamFromLocation(RepositoryUtil.java:159)
      at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:183)
      ... 53 more
  </code></pre>
  
  <p>When I added in the fonts, I added them to a jar which I then added to the class path. By the "input stream not found" error I'm guessing this is something to do with those fonts. But everything works fine in the normal clean-and-build process but I can't understand why the fat jar won't work.</p>
  
  <p>Any ideas?</p>
  
  <p>EDIT: Very similar to this <a href="https://stackoverflow.com/questions/12104794/font-extension-for-barcode-in-report">Font Extension for barcode in report</a></p>