title: JasperReports: calling report from jar
body: <p>I'm using <em>JasperReports 4.7.1 plugin</em> for <em>NetBeans 7.2</em> to generate report from mysql database 
  and while I run the application from the ide there is no problem found accept this warnings:</p>
  
  <pre><code>log4j:WARN No appenders could be found for logger (net.sf.jasperreports.engine.xml.JRXmlDigesterFactory).
  log4j:WARN Please initialize the log4j system properly.
  </code></pre>
  
  <p>But the report generated and viewed correctly. </p>
  
  <p>The problem is while I clean and build the application then rung it from the jar file the report does not generated and does not give me any exceptions just no reports viewed and every thing else is normal? </p>
  
  <p>This is the function I use for viewing the report in <em>JasperViewer</em>:</p>
  
  <pre><code>public void printInvoice(int invid) throws IOException {
      try {
          String sql = "SELECT\n" +
                  "     ordersdetails.`ITEMNAME` AS ordersdetails_ITEMNAME,\n" +
                  "     ordersdetails.`AMOUNT` AS ordersdetails_AMOUNT,\n" +
                  "     ordersdetails.`PRICE` AS ordersdetails_PRICE,\n" +
                  "     invoices.`INVOICEID` AS invoices_INVOICEID,\n" +
                  "     invoices.`CUSTOMER` AS invoices_CUSTOMER,\n" +
                  "     invoices.`THEDATE` AS invoices_THEDATE,\n" +
                  "     invoices.`COST` AS invoices_COST\n" +
                  "FROM\n" +
                  "     `invoices` invoices RIGHT OUTER JOIN `ordersdetails` ordersdetails ON invoices.`INVOICEID` = ordersdetails.`INVOICE` where invoices.invoiceid=" + invid;
  
          InputStream in = this.getClass().getResourceAsStream("/reports/invoice.jrxml");
  
          JasperDesign jd = JRXmlLoader.load(in);
  
          JRDesignQuery q = new JRDesignQuery();
          q.setText(sql);
          jd.setQuery(q);
  
          JasperReport jasp_rep = JasperCompileManager.compileReport(jd);
  
          JasperPrint jasp_print = JasperFillManager.fillReport(jasp_rep, null, mc.getConnection());
          JasperViewer.viewReport(jasp_print, false);
      } catch (JRException e) {
          JOptionPane.showMessageDialog(null, e.getMessage());
          System.out.println(e);
      }
  }
  </code></pre>