An illustrative example

There is a sample program called TestResultBean.java in <install_root>\help\designer\samples included in the JReport Result Bean package.

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 (JReport Designer, JReport Engine Bean or JReport Enterprise Server). It is not a .cls file. By calling the runReport and show() methods, the report result will be displayed.

As with the JReport Engine Bean, 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\designer\samples>
javac -classpath "C:\JReport\Designer\lib\JRResultviewer.jar;
C:\JReport\Designer\lib\log4j-1.2.8.jar;C:\JReport\Designer\lib\Itext.zip" TestResultBean.java