Mohamed Saligh Mohamed Saligh - 5 months ago 63
Java Question

How do I compile jrxml to get jasper?

I am new to JasperReports framework. I have jrxml file, I want to compile this to get .jasper. How do I compile and get that jasper file?

Please explain in details


There are three ways to compile jrxml to jasper.

  1. You can do direct compile via compile button (hammer logo) on iReport designer.

  2. You can use ant to compile as shown in the Ant Compile Sample.

    <target name="compile1"> 
      <mkdir dir="./build/reports"/> 
       <classpath refid="runClasspath"/>
       <include name="**/*.jrxml"/>

    Below is the report compile task on my current project.

    alt text

    addition from Daniel Rikowski :

  3. You can also use the JasperCompileManager class to compile from your java code.

                    our_jasper_template.jrxml",//the path to the jrxml file to compile
                    our_compiled_template.jasper");//the path and name we want to save the compiled file to