Using java.time.LocalDate in a field with Jasper Report
<p>I have an application developed in NetBeans 8.1 with iReport and JasperReport version 5.5.0 plugin. In my application, I have a jasper report with a <code>JRBeanCollectionDataSource</code>.</p>

<pre><code>LocalDate dateFrom = jDateChooser1.getDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate dateUntil = jDateChooser2.getDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
List&lt;Registru&gt; regs = db.getRegistreFrom(dateFrom, dateUntil);

Map&lt;String, Object&gt; params = new HashMap&lt;&gt;();
String absolutePath = "....\\rapoarte\\";
params.put("SUBREPORT_DIR", absolutePath);
InputStream in = getClass().getResourceAsStream("/rapoarte/registreListare.jasper");
JasperPrint jp = JasperFillManager.fillReport(in, params, new JRBeanCollectionDataSource(regs,false));

// ... code here
</code></pre>

<p><code>JRBeanCollectionDataSource</code> takes a parameter of List of Report class returned from the database</p>

<pre><code>public class Registru {
   private int id;
   private int nrReg;
   private LocalDate date;
   // ... getters and setters
}
</code></pre>

<p>The problem is that in the report the fields are :</p>

<pre class="lang-xml prettyprint-override"><code>&lt;field name="id" class="java.lang.Integer"/&gt;
&lt;field name="nrReg" class="java.lang.Integer"/&gt;
&lt;field name="date" class="java.time.LocalDate"/&gt;
</code></pre>

<p>but when I compile it, it gives me an error </p>

<blockquote>
  <p>java.time.LocalDate cannot be resolved to a type</p>
</blockquote>

<p>It works only if I put <code>&lt;field name="date class="java.lang.Object"/&gt;</code> but I cannot format the date.</p>

<p>I want to format the date of pattern <code>"dd-MM-yyyy"</code>.
Do I have to add something to the jasper's classpath?</p>