Adding support for Jasper reports to a project

Before you can create reports with EGL and Jasper, you must add support for Jasper reports to your project and add a Java™ compiler to your system's path variable.

Adding Jasper report support adds JAR files to your project that enable EGL to compile report design files. You only need to do this once for each project that uses Jasper reports, and there is no need to remove support from a project.

You can add support for Jasper reports only to EGL projects, not to EGL web projects.

  1. In the Project Explorer view, right-click your EGL project and then click Properties. The Properties window opens.
  2. In the Properties window, click EGL Project Features.
  3. Under EGL Project Features at the right side of the window, select the EGL with Jasper report support check box. If this check box is already selected, leave it selected.
  4. Click OK.

Alternately, you can enable Jasper report support in a new project. Select the EGL with Jasper report support check box in the New EGL Project wizard. Selecting this check box has the same effect as selecting the check box in the Properties window.

Adding the Java compiler to the PATH environment variable

To compile a report design file, EGL needs a Java compiler in your system's PATH environment variable.

Use a Java compiler with the same version as the version of Java you are using to generate EGL. Follow these steps to tell what level of Java you are using:
  1. Right-click an EGL project and then click Properties.
  2. In the Properties window, click Java Compiler.

    This page shows settings for the project's Java compiler. By default, the Enable project specific settings check box is cleared and the rest of the fields on the page are disabled.

  3. If the Enable project specific settings check box is selected, the version of Java that you are using in this project is shown in the Compiler compliance level field.
  4. If the Enable project specific settings check box is cleared, click Configure Workspace Settings. The Preferences window opens to the Compiler page, and the version of Java you are using for all your projects is shown in the Compiler compliance level field.

Follow these steps to add the Java compiler to your system:

  1. Obtain and install a Java SDK if you do not already have one. IBM® offers a Java SDK for download at the following website: http://www.ibm.com/developerworks/java/jdk/.
  2. In your system's PATH environment variable, add the location of the Java SDK. See your operating system documentation for instructions.

Adding support for PDF reports

If you want to export reports in Portable Document Format (PDF), follow these additional steps after adding support for Jasper reports:

  1. Download the file iText-1.3.jar from the following website:http://prdownloads.sourceforge.net/itext.
  2. In the Project Explorer view, right-click your project and then click Properties.
  3. In the Properties window, click Java Build Path.
  4. On the Libraries tab, click Add External JARs.
  5. In the JAR Selection window, select the iText-1.3.jar file that you just downloaded and click Open.

    Now the iText-1.3.jar file is listed under JARs and class folders on the build path.

  6. Click OK.

Setting the export location for reports in RCP mode

If you are creating reports in a Console UI application that is running in rich client platform (RCP) mode, you must set the osgi.user.area system property to the location where you want to store reports. Otherwise, reports will be created in the product installation directory.

  1. Click Run > Run. The Run window opens.
  2. From the list of runtime configurations, expand Eclipse Application and then click the run configuration for the program.
  3. On the Arguments tab of the run configuration, add the following code:
    -user "<location>"
    In place of <location>, use the directory to which you want to generate the reports.
  4. Click Apply to save changes to the run configuration.

Feedback