Home > Development > How to compile iReport from sources
 
How to compile iReport from sources
by Giulio Toffoli

In order to compile iReport from sources, we need three things:

  • The iReport sources

  • The NetBeans RCP 6.0.1, which is the rich client platform on which iReport is based

  • NetBeans IDE (6.0.1 or later) or Ant.

Getting the source code

All the releases of iReport include a package containing the source code. The name of the package is something like iReport-nb-3.6.0-src.zip. The last release can be found at http://sourceforge.net/projects/ireport/files/.
Anyway, the most updated code can be found in the SVN repository. To checkout the code you can your JasperForge.org login, or use the anonsvn for anonymous SVN access.
Use your favorite graphical tool for SVN to checout the source code from http://jasperforge.org/svn/repos/ireportfornetbeans.
If you like to use command line tools, just type in a shell:

svn checkout --username anonsvn http://jasperforge.org/svn/repos/ireportfornetbeans/trunk

This will download the whole trunk version of iReport on your computer.
For more details about the source code repository, go to the sources page.

Getting the NetBeans platform

The NetBeans platform 6.0.1 can be downloaded from http://download.netbeans.org/netbeans/6.0/final/zip/netbeans-6.0.1-200801291616-ml.zip.
Unzip that archive somewhere on your machine.

Compiling iReport using Ant

If for some reasons you don't want to install NetBeans, you can compile iReport from the command line.
Create the directory private inside nbproject which is a directory on the root of the iReport source tree.
Create a file inside private called platform-private.properties. Open called platform-private.properties with a text editor and put the following content:

nbplatform.NetBeans_IDE_6.0.1_(Build_200801291616).harness.dir=C:\\JasperSoft\\netbeans\\harness nbplatform.NetBeans_IDE_6.0.1_(Build_200801291616).label=NetBeans IDE 6.0.1 (Build 200801291616) nbplatform.NetBeans_IDE_6.0.1_(Build_200801291616).netbeans.dest.dir=C:\\JasperSoft\\netbeans

Change the paths to the NetBeans platform to point to where you have extracted the platform.
From a command prompt or a shell, adjust the maximum heap size for the JVM with the following command:

set ANT_OPTS=-Xmx1024m

Build and run iReport with the following command:

ant run

To create a zip distribution inside the dist directory type:

ant create-ireport-distro-zip

Compiling iReport using NetBeans

NetBeans is a popular open source Java IDE and it represents the best environment to write iReport plug-ins.
Download NetBeans from http://www.netbeans.org and install it.
In order to compile the iReport sources, we need to configure NetBeans to use the right platform. Select Tools → NetBeans Platforms.


Figure 1

The NetBeans Platform Manager pops up. Select Add Platform and locate the directory where the netbeans platform zip has been extracted.


Figure 2

When the platform 6.0.1 has been correctly installed, open the iReport project by selecting File → Open Project.... Locate the directory containing the iReport sources, the iReport directory inside trunk will be automatically recognized as iReport project suite.


Figure 3

Click the Run project button on the toolbar to compile the sources and run iReport.


Figure 4

To create a specific iReport distribution, right click the Build Script in the Important Files folder of the project, select Run Target and the target you want to run as shown in figure 5.


Figure 5


Now you are ready to create your first iReport plugin or play with the iReport sources.