Jump to content
We've recently updated our Privacy Statement, available here ×

TestFirstReport.java:1: package net.sf.jasperreports.engine does not exist


snocella

Recommended Posts

I am new to Jasper.  I downloaded iReports yesterday and created and exported a report.  I am now trying to deploy the report using the sample java code given.  When I try to compile, I get the following error. "TestFirstReport.java:1: package net.sf.jasperreports.engine does not exist".

I downloaded the jasperreports-4.1.2.jar file and put it in my class path and tried to recompile.  I still get the same error.  Any suggestions would be greatly appreciated.

Code:
import net.sf.jasperreports.engine.*;import net.sf.jasperreports.engine.export.*;import java.util.*;			public class TestFirstReport {    public static void main(String[] args) {        String fileName = "FirstTestReport.jasper";        String outFileName = "FirstTestReport.pdf";        HashMap hm = new HashMap();        try {            // Fill the report using an empty data source            JasperPrint print = JasperFillManager.fillReport(fileName, hm, new JREmptyDataSource());                        // Create a PDF exporter            JRExporter exporter = new JRPdfExporter();                        // Configure the exporter (set output file name and print object)            exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);            exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);                        // Export the PDF file            exporter.exportReport();                    } catch (JRException e) {            e.printStackTrace();            System.exit(1);        } catch (Exception e) {            e.printStackTrace();            System.exit(1);        }    }}			
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...