Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save the compiled JasperReport as a .jasper in a file

I have this code. I have a jrxml file. I can create a jasperReport object successfully. But I don't know how to create jasper file from this and I want to save jasper to a file location in c drive.

JasperReport jasperReport = null;
JasperCompileManager.compileReport(getResourceAsStream("Sample_Report.jrxml"));
    try {
        jasperReport = JasperCompileManager
                .compileReport("C:\\xxx.jrxml");
        System.out.println("jasper created " + jasperReport);
    } catch (Exception e) {
        e.printStackTrace();
    }
like image 727
TipTop Avatar asked Feb 12 '14 15:02

TipTop


1 Answers

The Method you want to use is

JasperCompileManager.compileReportToFile("C:\\xxx.jrxml", "C:\\xxx.jasper");
like image 55
user432 Avatar answered Oct 04 '22 03:10

user432