JReport provides you with some sample programs which demonstrate how to create and edit reports and library components using the Design API in <insatll_root>\help\samples\APIDesign
. They are:
To compile and run the sample programs, you should add jar files with their paths into the class path. Different jar files are required according to how the Design API is installed.
For example, you can use the following command to compile the sample program TestDesignInvoice.java:
C:\JReport\Designer\help\samples\APIDesign>javac -classpath "C:\JReport\Designer\lib\JREngine.jar;C:\JReport\Designer\lib\sac-1.3.jar;C:\JReport\Designer\lib\report.jar;C:\JReport\Designer\lib\log4j-core-2.7.jar;C:\JReport\Designer\lib\log4j-api-2.7.jar" TestDesignInvoice.java
When you run the sample programs, you need to provide two or three parameters. If you want to use two parameters, they should be catalog path and catalog name; if you want to use three parameters, they should be catalog path, catalog name and log file with a full path name.
The following example uses three parameters to run TestDesignInvoice.java. Here, it is assumed that JReport Designer has been installed to C:\JReport\Designer
, and the current directory when you execute these commands is C:\JReport\Designer\help\samples\APIDesign
(location of the sample programs). After running the program, you will find a newly created file TestInvoice.cls in C:\JReport\Designer\Demo\Reports\TutorialReports
.
C:\JReport\Designer\help\samples\APIDesign>java -Dreporthome="C:\JReport\Designer" -classpath "C:\JReport\Designer\lib\JREngine.jar;C:\JReport\Designer\lib\sac-1.3.jar;C:\JReport\Designer\lib\report.jar;C:\JReport\Designer\lib\log4j-core-2.7.jar;C:\JReport\Designer\lib\log4j-api-2.7.jar;C:\JReport\Designer\lib\resource_en_US.jar;C:\JReport\Designer\lib\hsqldb-2.3.4.jar" TestDesignInvoice -path=C:\JReport\Designer\Demo\Reports\TutorialReports -catalog=JinfonetGourmetJava.cat -report=TestInvoice.cls -log=C:\JReport\Designer\logs\designer.log