There are three ways to compile jrxml to jasper.
-
You can do direct compile via compile button (hammer logo) on iReport designer.
-
You can use ant to compile as shown in the Ant Compile Sample.
<target name="compile1"> <mkdir dir="./build/reports"/> <jrc srcdir="./reports" destdir="./build/reports" tempdir="./build/reports" keepjava="true" xmlvalidation="true"> <classpath refid="runClasspath"/> <include name="**/*.jrxml"/> </jrc> </target>
Below is the report compile task on my current project.
addition from Daniel Rikowski :
-
You can also use the JasperCompileManager class to compile from your java code.
JasperCompileManager.compileReportToFile( "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