1. Overview

When we talk about Reporting tools, a lot of software covers this area. However, most of them are full-fledged Business Intelligence platforms or Cloud services.

But, what happens if we just want to add some reporting features to our application as a library? We will review here some Java reporting tools well suited for this purpose.

We will mainly focus on these open-source tools:

In addition, we will briefly analyze the following commercial tools:

2. Designing Reports

Through this section, we’ll review how we can visually design reports and play with our data. Note we’ll be referring only to open-source tools in this part.

2.1. Visual Editors

All the three tools include a WYSIWIG editor with report previewing capabilities.

BIRT Report Designer and Jaspersoft Studio are tools built on Eclipse RCP. This is a good point for most of us Java developers, as we might be familiar with the Eclipse environment. Unlike those, Pentaho Report Designer has aged visually poorly.

Also, there is an additional interesting feature about Jaspersoft Studio: we can publish our reports directly on their Jasper Reports Server (the report management system).

2.2. Datasets

As with all reporting tools, we can retrieve datasets by querying a datasource (see below). Then, we can transform them into report fields, create computed fields, or use aggregation formulas.

Besides this, it’s interesting to compare how we can manage multiple datasets as we may need several of them if our data comes from different queries or even different datasources:

  • BIRT offers the easiest solution as we can have multiple datasets in the same report
  • With Jasper Reports and Pentaho, we need to create a separated subreport each time, which can be quite tricky

2.3. Charts and Visual Elements

All the tools provide simple elements like shapes and images, and also every chart flavor: lines, areas, pies, radar, ring, etc. All of them support cross-tabs too.

However, Jasper Reports provides the richest visual elements collection. It adds to the above list maps, sparklines, pyramids, and Gantt diagrams.

2.4. Styling Reports

Now, let’s compare the positioning and sizing of elements in the page:

  • All of the tools provide pixel-positioning
  • BIRT and Pentaho also provides HTML-like positioning (table, block, inline)
  • None of them supports CSS-like flexbox or grid system to control elements size

Also, when we have to manage multiple reports, we may want to share the same visual theme:

  • Jasper Reports provides theme files with XML-CSS syntax
  • BIRT can import CSS stylesheets into the design system
  • With Pentaho, we can only add CSS stylesheets in the page header. So it’s difficult to mix them with the internal design system

3. Rendering Reports

Now, that we’ve seen how to design reports, let’s compare how we can render them programmatically.

3.1. Installation

First, let’s note that all the tools have been designed to be easily embedded within a Java project.

To get started, you can have a look at our dedicated articles about BIRT and Jasper Reports. For Pentaho, there’s a help page and free code samples.

Next, for each of these tools, we will connect the report engine to our application data.

3.2. Datasource

The first question we should ask is: how can we connect the report engine to our project datasource?

  • Jasper Reports: we simply add it as a parameter of the fillReport method
  • BIRT solution for this is a bit more complex: we should modify our report to set the datasource attributes as parameters
  • Pentaho has a big drawback here: unless we buy their PDI commercial software, we have to use a JNDI datasource, which is more difficult to set up

Speaking of datasources, which types are supported?

  • All three tools support the most common types: JDBC, JNDI, POJOs, CSV, XML and MongoDB
  • REST API is a requirement for modern projects, however, none of them support it natively
    • with BIRT, we should code a Groovy script
    • Jasper Reports requires an extra free plugin
    • with Pentaho, we should code a Groovy script or acquire the PDI commercial software
  • JSON files are supported natively by Jasper Reports and Pentaho, but BIRT will require an external Java parser library
  • We can find the complete comparison list in this matrix

3.3. Parameters and Runtime Customization

As we have connected our report to our datasource, let’s render some data!

The important thing now is how to retrieve our end-user data. To do this, we can pass parameters to the rendering method. These parameters should have been defined when we designed the report, not at runtime. But what can we do if, for example, our dataset is based on different queries depending on the end-user context?

With Pentaho and Jasper Reports, it is simply not possible to do that, as the report file is binary and there is no Java SDK to modify them. By comparison, BIRT reports are plain-XML files. Moreover, we can use a Java API to modify them, so it’s very easy to customize everything at runtime.

3.4. Output Formats and Javascript Clients

Thankfully, most of the common formats are supported by all the tools: HTML, PDF, Excel, CSV, plain text, and RTF. Nowadays, we may also ask how we can integrate the report result directly into our web pages. We will not mention the rough inclusion of a PDF visualizer though.

  • The best solution is to use Javascript clients to render reports directly into an HTML element. For BIRT, the Javascript client is Actuate JSAPI and for Jasper Reports, we should use JRIO.js
  • Pentaho does not provide anything but iFrame integration. This solution works but may have serious drawbacks

3.5. Standalone Rendering Tools

Besides integrating our report into a web page, we may also be interested in having an out-of-the-box rendering server. Each tool provides its own solution:

  • BIRT Viewer is a lightweight web application sample to execute BIRT reports on-demand. It’s open-source but does not include report management features
  • for Pentaho and Jasper Report, there are only commercial software packages

4. Projects Status and Activity

First, a word about licenses. BIRT is under EPL, Jasper Reports under LGPLv3, and Pentaho under LGPLv2.1. Thus, we can embed all of these libraries into our own products, even if they are commercial.

Then, we can ask ourselves how these open source projects are maintained, and if the community is still active:

  • Jasper Reports has a well-maintained repository, with a stable medium activity by its editor TIBCO Software
  • BIRT repository remains maintained, but its activity is very low since 2015 when OpenText acquired its editor Actuate
  • Similarly, Pentaho repository activity is very low since Hitachi-Vantara acquisition in 2015

We can confirm this using Stackoverflow trends. The lowest popularity is for BIRT and Pentaho, but is moderate for Jasper Reports.

All three Java reporting tools have decreased in popularity in the past 5 years although remain stable for now. We can explain this by the emergence of the Cloud and Javascript offers.

5. Commercial Java Reporting Tools

Besides the open-source solutions, there are also some commercial options available that are worth mentioning.

5.1. Logi Report (formerly JReport)

Like Fine Report, Logi Report has been designed to be executed as a standalone server, but we can integrate it as part of our existing WAR project. Thus, we will face the same limitation as with Fine Report: we can’t generate reports programmatically.

Unlike Fine Report. however, Logi Report supports almost all servlet containers and  Java 8 to 13.

5.2. ReportMill Reporting

Finally, ReportMill is worth mentioning because we can embed it smoothly into every Java application. Also, like BIRT, it’s very flexible: we can customize reports at runtime as they are plain XML files.

However, we can see right away that ReportMill has aged, and also has a poor set of features comparing to the other solutions.

6. Conclusion

In this article, we went through some of the most well known Java reporting tools and compared their features.

As a conclusion, we can pick one of these Java Reporting Tools depending on our requirements:

We’ll choose BIRT:

  • For a simple library to replace an existing home-made solution
  • For its greatest flexibility and high customization potential

We’ll choose Jasper Reports:

  • If we need a reporting library compatible with a full-fledged report management system
  • If we want to bet on the best long-term evolution and support

 

Course – LS (cat=Java)

Get started with Spring and Spring Boot, through the Learn Spring course:

>> CHECK OUT THE COURSE
res – REST with Spring (eBook) (everywhere)
2 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.