IREPORTS java.lang.NullPointerException
<p>I am building a Java app in Netbeans and everything works in the IDE via run but once I build and run the jar directly the Jasper Reports fail to open.
Any help would be greatly appreciated this is driving me nuts</p>

<p>The stack trace</p>

<pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at java.io.ObjectInputStream$PeekInputStream.read(Unknown Source)
        at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
        at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
        at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
        at java.io.ObjectInputStream.&lt;init&gt;(Unknown Source)
        at net.sf.jasperreports.engine.util.ContextClassLoaderObjectInputStream.&lt;init&gt;(ContextClassLoaderObjectInputStream.java:56)
        at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:277)
        at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:262)
        at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:415)
        at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:838)
        at membershipdb.MemberProgram.MembersReportButtonActionPerformed(MemberProgram.java:184)
        at membershipdb.MemberProgram.access$000(MemberProgram.java:34)
        at membershipdb.MemberProgram$1.actionPerformed(MemberProgram.java:85)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$500(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
</code></pre>

<p>The Code</p>

<p>at membershipdb.MemberProgram.access$000(MemberProgram.java:34)</p>

<pre><code>public class MemberProgram extends javax.swing.JFrame {
</code></pre>

<p>at membershipdb.MemberProgram$1.actionPerformed(MemberProgram.java:85)</p>

<pre><code>MembersReportButtonActionPerformed(evt);

MembersReportButton.setText("&lt;html&gt;&lt;CENTER&gt;MEMBER&lt;BR&gt;REPORT&lt;/HTML&gt;");
    MembersReportButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            MembersReportButtonActionPerformed(evt);
        }
    });
</code></pre>

<p>at membershipdb.MemberProgram.MembersReportButtonActionPerformed(MemberProgram.java:184)</p>

<pre><code>JasperPrint jp = JasperFillManager.fillReport(is, null, conn);
</code></pre>

<p>The full code of the button</p>

<pre><code>    private void MembersReportButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                    
        Connection conn = DBConnection.getConnection();
        //Path to your .jasper file in your package
        String reportName ="reports/MembersReport.jasper";
        //Get a stream to read the file
        InputStream is = this.getClass().getClassLoader().getResourceAsStream(reportName);    
try{
        //Fill the report with parameter, connection and the stream reader     
            JasperPrint jp = JasperFillManager.fillReport(is, null, conn);
        //Viewer for JasperReport
            JRViewer jv = new JRViewer(jp);
     //Insert viewer to a JFrame to make it showable
            JFrame jf = new JFrame();
            Component add = jf.getContentPane().add(jv);
            jf.validate();
            jf.setVisible(true);
            jf.setExtendedState(JFrame.MAXIMIZED_BOTH);
            jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        } catch (JRException ex) {
            ex.printStackTrace();
    } 

    }              
</code></pre>