0

I have installed the Jaspersoft Studio plugin from marketPlace. I created a java project and converted it to Maven to import the Jasper report jars. Afterwards I created a Blank_A4.jrxml file. Therefore, i added some java class from this tutorial

https://www.tutorialspoint.com/jasper_reports/jasper_filling_reports.htm

as in the screenshot below.

The problem is when run the .jrxml file, there is nor .jasper file is being gernerated. Does anyone know what the problem is?

enter image description here

I have changed the path ofsourceFileName in this class:

package com.tutorialspoint;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;

public class JasperReportFill {
   @SuppressWarnings("unchecked")
   public static void main(String[] args) {
      String sourceFileName = 
            "C://Users/alex.tree/Documents/iReport Designer workspace/Blank_A4.jasper";

      DataBeanList DataBeanList = new DataBeanList();
      ArrayList<DataBean> dataList = DataBeanList.getDataBeanList();

      JRBeanCollectionDataSource beanColDataSource =
      new JRBeanCollectionDataSource(dataList);

      Map parameters = new HashMap();
      /**
       * Passing ReportTitle and Author as parameters
       */
      parameters.put("ReportTitle", "List of Contacts");
      parameters.put("Author", "Prepared By Manisha");

      try {
         JasperFillManager.fillReportToFile(
         sourceFileName, parameters, beanColDataSource);
      } catch (JRException e) {
         e.printStackTrace();
      }
   }
}
Alex K
  • 22,315
  • 19
  • 108
  • 236
water
  • 405
  • 1
  • 5
  • 13
  • `The problem is when run the .jrxml file, there is nor .jasper file is being gernerated.` - What do you mean? What did you do for generating *.jasper* file? – Alex K Nov 03 '16 at 18:54
  • 2
    Here is the answer. You need to compile report http://stackoverflow.com/questions/4456779/how-do-i-compile-jrxml-to-get-jasper – Olya Bondareva Nov 03 '16 at 23:27

0 Answers0