issue running report from java

hi am trying to create report in pdf am geting this error

Not enough arguments.
Usage: java Base64 -e|-d inputfile outputfile

 

this my calass

package com.infybuzz.report;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
 
public class FirstReport {
 
    public static void main(String[] args) {
 
        try {
            String filePath = "/home/rabitvm/Documents/jasper/Setting-Up-Java-Project-with-Jasper/src/main/resources/FirstReport.jrxml";
 
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("studentName", "Tshifhiwa");
 
        Student student2 = new Student(1L,"lerato","moloi","Rubestein street","pretoria");
 
        Student student3 = new Student(1L,"john","michaeal","Rubestein street","Cape town");
 
        List<Student> list = new ArrayList<Student>();
        list.add(student3);
        list.add(student2);
 
        JRBeanCollectionDataSource dataSource  = new JRBeanCollectionDataSource(list);
 
        JasperReport report = JasperCompileManager.compileReport(filePath);
 
        JasperPrint print = JasperFillManager.fillReport(report, parameters,dataSource);
        JasperExportManager.exportReportToPdfFile(print,"/home/rabitvm/Documents/jasper/Setting-Up-Java-Project-with-Jasper/src/main/resources/FirstReport.pdf");
 
        System.out.println("Report Created...");
 
        } catch(Exception e) {
            System.out.println("Exception while creating report");
        }
    }
 
}

tdmadima's picture
Joined: Dec 20 2019 - 7:25pm
Last seen: 3 days 22 hours ago

0 Answers:

No answers yet
Feedback