ministrymason Posted April 29, 2010 Share Posted April 29, 2010 I have a main report containing 5 sub reports it all works great in Ireport but If i delete all of the subreport .jasper files so im left with the subreport.jrxml files. I get the following error when run in eclipse.JRException=Could not load object from location : C:/jasperReports/subreport.jasperDoes this mean that the subreports all have to be pre compiled before i run the main report? As its saying it cannot find the .jasper? Link to comment Share on other sites More sharing options...
me_vsoundar Posted April 29, 2010 Share Posted April 29, 2010 Hello, The ".jasper" files are similar to ".class" file. When run the application, jasper files are important, bcoz, the compiler needs the jasper files only not the jrxml. if u can run an application without jrxml but not .jasper. so compile the jrxml and put the jasper in the appropriate location and run it. Bye Link to comment Share on other sites More sharing options...
tmatyashovsky Posted May 10, 2010 Share Posted May 10, 2010 In case when you are creating report from Java code I would suggest to use code similar to listed below: InputStream fullPathToSubReportAsInputStream = new ClassPathResource("SUBREPORT1.jrxml").getInputStream(); /* Compiling the report using prepated template. */JasperReport subreport1 = JasperCompileManager.compileReport(fullPathToSubReportAsInputStream ); /* Setting sub report 1 as a parameter of main report. */parameters.put("SUBREPORT1", subreport1); Hope that will help. Best regards,Taras Matyashovsky 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