title: Java JasperReports Barcode print
body: <p>I need to print Bar code labels using <code>JasperReports</code> reporting. I have properly design the Jasper report and I can preview it using <code>iReport</code>. But when I pass parameter to jasper report via Java application bar code report never generated.</p>
  
  <p>following code are used   </p>
  
  <pre><code>//Print barcode
  try {
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      Connection conn = (Connection) 
              DriverManager.getConnection("jdbc:mysql:///miracleposdb", "root", "mysql");
  
  
      String reportSource = "../src/reports/barcode.jrxml"; /* Report Path*/
      Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;();
      params.put("printid", lblbarcodeID.getText());
  
      JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); /*Compiling  */
  
      JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
              params, DB.MiraclePOS.connect());  /*Filling report*/
      JasperViewer.viewReport(jasperPrint, false);   /*For Print*/
  
  } catch (Exception e) {
  }
  </code></pre>