jdeppuser Posted September 15, 2016 Share Posted September 15, 2016 I found code to produce a report via java code and thought this would be easily possible but found too many errors occurring. I am able to create a report from a template using the normal procedural steps but programmatically it fails. This is critical as i need to be able to query the DB and render the reports automatically on a schedule. net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: C:UsersmmmDocumentsworkspace-sts-webappsHelloJasperfirstReport.jrxml (The system cannot find the file specified) JRResultSetDataSource rsdt=new JRResultSetDataSource(rs); JasperReport jrpt = JasperCompileManager.compileReport("C:\Users\mmm\Documents\workspace-sts-webapps\HelloJasper\firstReport.jrxml"); //InputStream is=this.getClass().getResourceAsStream("firstReport.jrxml"); //jrpt = JasperCompileManager.compileReport(is); JasperPrint jp = JasperFillManager.fillReport(jrpt, new HashMap(), rsdt); JasperViewer jv = new JasperViewer(jp); jv.setVisible(true); [/code] Now when I actually add the report first using one of the templates, I get another error: et.sf.jasperreports.engine.JRException: Error compiling report java source files: C:UsersmmmDocumentsworkspace-sts-websHelloJasperfirstReport_1473970204847_393001.java Link to comment Share on other sites More sharing options...
hozawa Posted September 16, 2016 Share Posted September 16, 2016 That's strange because in your code, you've written to "C:\Users\mmmmmm" but the error is saying "C:Usersme". Seems you're logged in as a different user? Link to comment Share on other sites More sharing options...
jdeppuser Posted September 16, 2016 Author Share Posted September 16, 2016 sorry about that, I just edited it differently for this post 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