title: How to add image as parameter from projects classpath in jasper reports
body: <p>I designed a jasper report using ireport designer in which I added logo image in the title of the report. This image is added from the hard coded path on the local machine. I need to add the logo image from my projects classpath. To do that I  created a parameter for the image in the report which is supplied from the program.</p>
  
  <pre><code>InputStream imgInputStream = this.getClass().getResourceAsStream("header.png");
  
  HashMap&lt;String, Object&gt; parameters = new HashMap&lt;String, Object&gt;();
  parameters.put("dateFrom", datum1);
  parameters.put("dateTo", datum2);
  parameters.put("logo", imgInputStream);
  
  
  strQuery = "Select calldate,src,dst,duration,disposition,cdrcost from cdrcost where date(calldate) between '" + datum1 + "' and '" + datum2 + "'";
  
  rs = conexiondb.Consulta(strQuery);
  JRResultSetDataSource resultSetDataSource = new JRResultSetDataSource(rs);
  //JasperPrint jasperPrint = JasperFillManager.fillReport(reportStream, parameters);
  
  JasperRunManager.runReportToPdfStream(reportStream, fos, parameters, resultSetDataSource);
  </code></pre>
  
  <p>And below is the image snippet from the report:</p>
  
  <pre><code>&lt;image&gt;
    &lt;reportElement x="0" y="1" width="555" height="61"/&gt;
    &lt;imageExpression&gt;&lt;![CDATA[$P{logo}]]&gt;
    &lt;/imageExpression&gt;
  &lt;/image&gt;
  </code></pre>