Jump to content
Changes to the Jaspersoft community edition download ×

newbie Question on Starting Abend


AndyDavis51

Recommended Posts

Hello All

 

I AM new to using Jasperreports.

 

Using Netbeans 5.0 with JDK 1.5 on Windows 2000/xp systems

 

when i am running a report using code given below i get a abend and am not sure what it is telling me as code complies but abends on execute (Report works when designed/view using iReports.

 

----- Code

 

public static void main(String[] args) {

JasperReport jasperReport;

JasperPrint jasperPrint;

try {

 

jasperReport = JasperCompileManager.compileReport("c:\GrpRpt.jrxml");

 

 

} catch (JRException ex) {

ex.printStackTrace();

}

 

I get this abend does any one have a clue why this is happing or have i missed something.

 

--- Abend

 

Java.io.FileNotFoundException: C:Documents and Settingsa1dlonReportITGrpRpt_1160471753177_959544.class (The system cannot find the file specified)

at java.io.FileInputStream.open(Native Method)

at java.io.FileInputStream.<init>(FileInputStream.java:106)

at net.sf.jasperreports.engine.util.JRLoader.loadBytes(JRLoader.java:272)

at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:73)

at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190)

at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105)

at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211)

at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:144)

at reportit.Main.main(Main.java:40)

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

If "GrpRpt.jrxml" is in the top level of C: drive then you need to put double backward slashes like this

 

Code:

jasperReport = JasperCompileManager.compileReport("c:\GrpRpt.jrxml"«»);

 

In linux I do it like this:

Code:
[code]
String reportSource = "./src/net/veenas/core/report/templates/CustomerDetails.jrxml";
String reportDestPDF = "./report/results/pdf/customers/customerDetails.pdf";
String reportDestHTML = "./report/results/html/customers/customerDetails.html";
JasperReport jasperReport = JasperCompileManager.compileReport(reportSource);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,parameterMap);
JasperExportManager.exportReportToHtmlFile(jasperPrint,reportDestHTML);
JasperExportManager.exportReportToPdfFile(jasperPrint,reportDestPDF);

 

Try using double slashes. I am not sure if it works as i never tried JR in Windows :)

Post edited by: thelinuxmaniac, at: 2006/10/10 10:57

Link to comment
Share on other sites

It get stranger and Stranger been working on it all day.

 

Class Files are being generated when i set

 

System.setProperty("jasper.reports.compile.keep.java.file","true");

 

and i can see them in the folder in Question being Generated java.class.PATH looks ok

 

C:JasperReportsReportITbuildclasses;

C:JasperReportsjasperreports-1.2.7.jar;

C:JasperReportscommons-digester-1.7.jar;

C:JasperReportscommons-collections-3.2.jar;

C:JasperReportscommons-logging-1.1.jar;

C:JasperReportscommons-beanutils-bean-collections.jar;

C:JasperReportscommons-beanutils-core.jar;

C:JasperReportscommons-beanutils.jar

 

Javac is in System32 on Windows

 

So hope this gives some more Ideas.

Link to comment
Share on other sites

The best way to avoid all this is to use the JDT report compiler which doesn't need to write/read anything to/from the filesystem and doesn't need a separate classpath as it uses the context class loader to load classes needed during compilation.

 

To use the JDT report compiler, simply include in your application's classpath the jdt-compiler jar distributed with JR (or the JDT core jar from Eclipse).

 

HTH,

Lucian

Link to comment
Share on other sites

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...