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

parispanayi

Members
  • Posts

    1
  • Joined

  • Last visited

parispanayi's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi all, I use the libraries below: mssqlserver.jar msbase.jar msutil.jar commons-logging-1.1.1.jar commons-digester-2.1,jar commons-collections-3.2.1.jar commons-beanutils-1.8.3.jar itextpdf-5.4.0.jar and the source code loks like this: import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import com.microsoft.jdbc.sqlserver.SQLServerDriver; import com.microsoft.jdbc.base.BaseDriver; import org.apache.commons.logging.LogFactory; import java.util.HashMap; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperFillManager; import java.io.IOException; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperPrint; import org.apache.commons.digester.Digester; import org.apache.commons.collections.ReferenceMap; import org.apache.commons.beanutils.MethodUtils; import com.itextpdf.text.SplitCharacter; import com.itextpdf.text.pdf.PdfWriter; public class JavaApplication5 { public static void main(String[] args) { HashMap hm = null; System.out.println("Usage: ReportGenerator ...."); try { System.out.println("Reading Paths..."); String jrxmlFileName = "C:/Reports/Orthodoxia/FirstTest.jrxml"; String jasperFileName = "C:/Reports/Orthodoxia/FirstTest.jasper"; String pdfFileName = "C:/Reports/Orthodoxia/FirstTest.pdf"; System.out.println("Compiling..."); JasperCompileManager.compileReportToFile(jrxmlFileName, jasperFileName); System.out.println("Setting Database Connection..."); String dbUrl = "jdbc:sqlserver://localhost:1433;databaseName=Orthodoxia"; String dbDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; String dbUname = "sa"; String dbPwd = "2604"; Class.forName(dbDriver); Connection conn = DriverManager.getConnection(dbUrl, dbUname, dbPwd); // Create arguments //Map params = new HashMap(); hm = new HashMap(); //hm.put("ID", "123"); //hm.put("DATENAME", "March 2013"); System.out.println("Running Report..."); JasperPrint jprint = (JasperPrint) JasperFillManager.fillReport(jasperFileName, hm, conn); System.out.println("Exporting to pdf..."); JasperExportManager.exportReportToPdfFile(jprint, pdfFileName); System.out.println("Done exporting reports to pdf"); } catch (JRException e){ e.printStackTrace(); } catch (ClassNotFoundException e){ e.printStackTrace(); } catch (SQLException e){ e.printStackTrace(); } } } When I compile tthis source code, it returns an error: Exception in thread "main" java.lang.NoClassDefFoundError: com/lowagie/text/SplitCharacter at net.sf.jasperreports.engine.JasperExportManager.exportToPdfFile(JasperExportManager.java:145) at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:497) at javaapplication5.JavaApplication5.main(JavaApplication5.java:50) Caused by: java.lang.ClassNotFoundException: com.lowagie.text.SplitCharacter at the line where the pdf should b exported: JasperExportManager.exportReportToPdfFile(jprint, pdfFileName); Can someone explain to me why the compiler looks for something in a library which is the older version of the itext one I use? This class exists in my itext library but for some reason it is ignored. Please help me to solve the problem!
×
×
  • Create New...