Jump to content

issue running report from java


tdmadima

Recommended Posts

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");        }    }}[/code]

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...