Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-15-2007, 03:43 PM
Ed Ed is offline
Senior Member
 
Join Date: Jun 2007
Posts: 110
Ed is on a distinguished road
Jasper Report + iReport + NetBeans 4
I'm trying to do some reports in jasper, but I have some difficulties to do it, can you help me?
I downloaded from http://jasperreports.sourceforge.net/

jasperreports-0.6.5.jar
jasperreports-0.6.5-applet.jar

and I copied them in this path:

C:\j2sdk1.4.2_07\jre\lib\ext

After that I generated an simple report and compile with iReport 0.4.1

C:\reports\rep_cli.jasper

Then I created a project in NetBeans 4 to execute my report, this is the code:

Code
Code:
package reportload; import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.export.*; import net.sf.jasperreports.engine.util.*; import net.sf.jasperreports.view.*; import java.sql.*; import java.io.*; import java.util.*; public class Main { public Main() { } public static void main(String[] args) { try { String fileName="C:\\reports\\rep_cli.jasper"; String destFileNamePdf="C:\\reports\\rep_cli.pdf"; String destFileNameXls="C:\\reports\\rep_cli.xls"; Map parameters = new HashMap(); parameters.put("sql_query", new String("select * from clients")); JasperPrint jasperPrint=JasperFillManager.fillReport(fileName, parameters, getConnection()); JasperExportManager.exportReportToPdfFile(jasperPrint, destFileNamePdf); JRXlsExporter exporter = new JRXlsExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFileNameXls); exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); exporter.exportReport(); System.exit(0); } catch (Exception e) { System.out.println(e.getMessage()); } } private static Connection getConnection() throws ClassNotFoundException, SQLException { //Configuración de la conexión. String driver = "org.postgresql.Driver"; String connectString = "jdbc:postgresql://192.168.1.7:5432/bdtest"; String user = "user"; String password = "123"; Class.forName(driver); Connection conn = DriverManager.getConnection(connectString, user, password); return conn; } }
When I compile the code it returns to me this error in this line:
Code:
JasperPrint jasperPrint=JasperFillManager.fillReport(fileName, parameters, getConnection());
the error message is:
Error loading object from file : C:\reports\rep_cli.jasper
I don't know what is the problem
can you help me?
I am desperate
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-02-2007, 09:38 PM
Senior Member
 
Join Date: Jun 2007
Posts: 130
Jack is on a distinguished road
check the versions of your iReport because in the directory of the iReport there is *.jar of the jasperreport you should check with what version you open the reports.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-02-2007, 09:39 PM
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
check if these jar are correct
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-logging.jar
itext-1.2.jar
poi-2.5.1-final-20040804.jar
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Jasper report + JPQL tarat Advanced Java 2 08-01-2008 08:47 PM
org.apache.jasper.JasperException: null ranjan_ashish26 Java Servlet 1 03-21-2008 07:06 AM
Jasper iReports and Java shinky New To Java 2 08-09-2007 11:24 AM
Error With Sql And Jasper Report Heather Database 3 07-31-2007 08:07 AM
iReport Freddie Advanced Java 2 07-25-2007 02:19 PM


All times are GMT +3. The time now is 01:30 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org