How can I use custom classes or additional libaries in my Jasper Report?

0

I am using the JasperSoft Studio Plugin for Ecplise. I have created my own custom JRDataSource. Using the Data Adapter Wizard I was able to use my custom JRDataSource.However I add to add the jar containing the class depsite the class being in the same Eclipse Projec which I have given "JasperReport Nature". I was able to preview a simple report using the data source.

However I am encountering problems when I try using additional 3rd party libs or custom classes.

Problem 1: One of the fields is of type java.time.LocalDateTime. If I use this field in the report then the report does not compile with a ClassNotFoundException

<field name="startTime" class=" java.time.LocalDateTime"/>

Problem 2: My data source has a method to return the data source of a sub report:

<dataSourceExpression><![CDATA[((com.sample.MyCustomDataSource)$P{REPORT_DATA_SOURCE}).getSubReportDataSource()]]></dataSourceExpression>

If I define a sub report with this data source expression then the report does not compile with a ClassNotFoundException.

Question: Is it possible to add custom classes or libraries to a report and how can I achieve this? I have read several posts about this but I haven't yet found a solution. The class path for the Eclipse  is set up correctly.

Regards,

Anette

anette.engel's picture
Joined: May 2 2018 - 4:15am
Last seen: 1 year 1 month ago

0 Answers:

No answers yet
Feedback