title: How can I pass an integer parameter value in JasperReport from Java code?
body: <p>So I've successfully created my report and I've been trying to get an int variable as a parameter into my query, but I keep on getting this error:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ReferenceMap
  </code></pre>
  
  <p>The code I have to deliver the parameter is this:</p>
  
  <pre><code>private void report(){
      try {
          Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/DB?autoReconnect=true&amp;useSSL=false", "root", "root");
  
          Map parameter = new HashMap();
  
          parameter.put("ID", last_Report);
  
          String path = System.getProperty("user.dir") + "/src/Reports/Report1.jrxml";
  
          JasperReport content = JasperCompileManager.compileReport(path);
  
          JasperPrint printRep = JasperFillManager.fillReport(content, parameter, con);
  
          JasperViewer.viewReport(printRep);
  
      } catch (JRException ex) {
          Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
      } catch (SQLException ex) {
          Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
      }
  }
  </code></pre>
  
  <p>I already checked if the <code>last_Report</code> variable has a proper value, and it does have an int, and when I print the Map, I get this: <code>[{ID=25}]</code>.</p>
  
  <p>I have my parameter declared here:</p>
  
  <pre><code>&lt;parameter name="ID" class="java.lang.Integer"&gt;
      &lt;defaultValueExpression&gt;&lt;![CDATA[]]&gt;&lt;/defaultValueExpression&gt;
  &lt;/parameter&gt;
  </code></pre>
  
  <p>And this is my query:</p>
  
  <pre><code>Select * from Reports where reports_ID = $P{ID};
  </code></pre>
  
  <p><strong>Edit</strong>: I removed and re added all the libraries, and now I'm getting this:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester
  </code></pre>
  
  <p>Libraries I currently have:</p>
  
  <ul>
  <li>mysql-connector-java-5.1.45-bin.jar</li>
  <li>commons-beanutils-1.9.3.jar</li>
  <li>commons-collections4-4.1.jar</li>
  <li>commons-digester3-3.2.jar</li>
  <li>commons-logging-1.2.jar</li>
  <li>itext7-7.0.2.zip</li>
  <li>jfreechart-1.0.19-demo.jar</li>
  <li>jxl.jar</li>
  <li>poi-3.17.jar</li>
  <li>jasperreports-6.5.1.jar</li>
  <li>jasperreports-fonts-6.5.1.jar</li>
  <li>jasperreports-javaflow-6.5.1.jar</li>
  </ul>