Compile with older JasperReports version from Jaspersoft Studio


Jaspersoft Studio always uses and embedded version of JasperReports (tipically the one with the same version number of Studio) to build the report. Sometimes the user want to compile with an older version without used an older version of Jaspersoft Studio. This mostly because JasperReports dosen't provide an interface (graphical or from command line) to compile the report, so using it directly need some Java skills. For this reason was introduced inside Jaspersoft Studio a backward compatible compiler that can be used to compile a report with many JasperReports version and everything, from the download of the desired version of JasperReports to the use of it to compile, can be done trough a simple graphical interface.

Download the desired version of JasperReports

The first step to compile with an older version is download the files of that version. Jaspersoft Studio offer a simple interface to do this and to move the downloaded files in the right directory. First of all open the report you want to compile and expand the compile menu from the compile button on the editor. From the menu select "Manage JasperRepoers Version"

A wizard will appear, showing all the JasperReports versions you can download and the ones you have already available. The version already on your disk will have a check mark on them, if this is the first time you use this feature then you shouldn't have any mark since there are no older version of JasperReports included in Studio by default. In this step when you check a version you don't have it will be downloaded from internet, so you will need an internet connection. The download can take some time depending on your connection speed, during the download will be shown the amount of data downloaded, cosnider that a JasperReports version has an average size of  about 100MB. Always in this step when you uncheck something previously checked then it means you want to remove a JasperReports version from your system, so if you want to be able to use that version to compile you will need to redownload it. You can select or deselect any number of versions and the operation on them will be done sequentially

For example select the version 4.7.0 and hit "Next".

Now the download will start and you will not able to proceed with the wizard until it is finished. However you can abort the operation anytime, but in this case the files versions that was not completely downloaded will not be usable for the compilation.

Once the operations are completed you will see a summary page where you have only to click "Finish".

Compile with the downloaded version of JasperReports

At this point you can compile your file, still expand the compile menu from the compile button and you will see a new option to compile the current file with all the downloaded versions. Select "Compile with JasperReports 4.7.0"

The output of the compilation process is shown on a console view, it is also shown the command used to compile the report so the users can review advanced informations like the classpath.

At this point you will find in the same location of the source file the jasper file generated with JasperReports 4.7.0. However maybe you don't want that a file generated with this version is placed inside the workspace among other japser files generated with different versions or also because you don't want it replaced by the automatic building. For this reason you can configure the output path. Form the compile menu go in the submenu "Backward Compatible Binary Destination". From here you can add a new absolute path on the filesystyem, select "Add destination path" to open the browse dialog and select the folder you want to use as output.

The added folder will be used from now as default location, now every backward compilation will place the resulting file on the selected folder. You can access anytime to this menu and select one of the existing destination or add a new one. The menu will remember the last eight custom location allowing to switch between them easily, without need to select each time the target folder from the browser.

Remember that the output folder is used only by the backward compatible JasperReports compiler, if you press directly the compile button will be used always the last version of JasperReports and the result of the compilation will be placed among the source, since it is a standard building.

Delete the unnecessary JasperReports versions

You can delete in any moment the old JasperReports versions you want to use. From the compile menu reopen the wizard trought "Manage JasperReports versions" like show in the first image. Now you will see already marked the version that are currently on your system. Unmark the ones you want to delete and press "Next" and they will be delete. Obviously since they are no more on your system you will not able to compile a report with that versions anymore, if you want to use on of it you must download it like you have done the first time.

Advanced information

Compiling the file in this way is something external to the core of Jaspersoft Studio application. Jaspersoft Studio will internally use alway the last version of JasperReports and there is now way to switch it. For this reason the preview dialog will aways shown a report compiled with the last version and also all the other functions like the export and so on. This backward compatible compilation is provided with the purpose to allow to easly compilate the jrxml and use it outside Jaspersoft Studio, because many users want to use the last version of Jaspersoft Studio but still want a jasper file compiled with an older version of JasperReports because it is the one required from some third parties programs. Also for this reason the output of the compilation is shown in a separate console instead of the Report State view as usually.

About the classpath used to compile the file, this procedure will try to use in the compilation proccess the same classpath that is defined on the project that contains the source file. The used classpath can be seen by the user when the backward compilation process is satarted. In the console will be paint the command used to compile the source file and in it there is written the used classpat, after the option "-cp".



The above instructions are not current. I installed latest Studio (6.15) on my new dev laptop and need to compile reports to version 6.6.0 for compatibility with prior reports and website. However, the interface for this is different in 6.15. I can get to the 'Manage JasperReports Versions' link but the dialog window asks for a URL or Path to the version I wish to use, rather than choosing from a list of versions. Is there a repository of past versions I can get links to, and what file exactly am I linking to?

Thanks in advance for the support.

I am able to get the url of old versions: 

It downloaded the old version of jars but on compiling stuck with following issue:

java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.DefaultJasperReportsContext

Please let me know if you have a solution to overcome it.

Same problems here with version 6.13