An illustrative example

There is a sample program called TestResultBean.java in <install_root>\help\samples\APIViewResult included in the JReport Server and JReport Designer installation.

The properties for the report are very simple, and you will only need to set the ReportName. Note that here the report name is the report result .rst file generated by JReport Engine. It is not a .cls file. By calling the runReport and show() methods, the report result will be displayed.

The report result can be exported to other formats such as HTML, PDF, RTF or to a printer. You will need to use the appropriate methods and parameters.

To run TestResultBean.java, you can use the following command to compile the sample program first (assume that JReport Designer has been installed to C:\JReport\Designer):

C:\JReport\Designer\help\samples\APIViewResult>
javac -classpath "C:\JReport\Designer\lib\JRResultviewer.jar;
C:\JReport\Designer\lib\log4j-1.2.8.jar;C:\JReport\Designer\lib\itext_1.5.4.jar" TestResultBean.java