How do I compile jrxml to get jasper?
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
For anyone coming across this question who uses Jaspersoft Studio (which, I think, is replacing iReports; it's quite similar, still freeware, just based on eclipse), look for the "Compile Report" icon on top of the editor area of your .jrxml file. Its icon, first in that line of icons, is a file with binary numbers on it (at least in version 5.6.2):
Clicking this icon will generate the .jasper file in the same directory as the .jrxml file.