Does JDK 8 supports JasperReports 6?

2019-06-20 18:23发布

问题:

I've been trying to get my report working for few days but still no luck. I have no idea if it's something wrong with the dependencies.

I asked this question previously.

Anyway i just want to know if anyone have used JasperReports 6 with JDK 8? after all i doubt if these are compatible.

回答1:

Update your JDT

   <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>5.6.1</version>
        <exclusions>
            <exclusion>
                <groupId>eclipse</groupId>
                <artifactId>jdtcore</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.eclipse.jdt.core.compiler</groupId>
        <artifactId>ecj</artifactId>
        <version>4.4</version>
    </dependency>

Source : How to Run JasperReport with Java 8



回答2:

I just figured out the issue after trying few days. My report didn't work not due to an incompatibility issue. But because i haven't used

JasperPrint jp = JasperFillManager.fillReport(jr, param, new JREmptyDataSource());

instead of

JasperPrint jp = JasperFillManager.fillReport(jr, param);

Yes. JDK 8 is compatible with JasperReports 6.

JasperReports doesn't have enough community support i had to figure this out by my self. Anyway i suggest that JasperReports library should be much improved.