snocella Posted October 27, 2011 Share Posted October 27, 2011 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 More sharing options...
iamwoodyjones Posted October 27, 2011 Share Posted October 27, 2011 You still have something wrong with your classpath. You'll have to fiddle with it more. Link to comment Share on other sites More sharing options...
e.rakesh80 Posted June 10, 2013 Share Posted June 10, 2013 I am having same issue. I am getting same error. I am compiling the code in jdk 1.7 through command line. I am compiling the code in winXp 32 bit and jaspersoft 5.1.0 is installed in my machine. Can some body help me on this Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now