2005 IR Help Posted August 26, 2006 Share Posted August 26, 2006 By: Ahsan Khan - optimistic___ unable to run jasperreports from java applica 2004-05-20 00:42 I have made reports on Jasper Reports using SunShine reports, the resultant is a .xml file as expected. Now how can i run this report from my java application, i have used the methods, specified but its not working, can somebody tell me wat exact procedure should i follow, should it be a classpath issue. i have set the d:jasperreportsclasses in the classpath, but still having error. By: C-Box - c-box RE: unable to run jasperreports from java applica 2004-05-20 02:14 ... and a third time.... *unbelievable* ... please... ONE thread is enough.... and if you want to get it on top, then reply to your own thread again, and ask again or what ever. https://sourceforge.net/forum/message.php?msg_id=2578193 C-Box By: Mark Engstrom - me2kme RE: unable to run jasperreports from java applica 2004-05-20 03:11 Can you provide an example of the code you are using to view the report and any exceptions . As a general rule ( allowing for my rubbish coding technique ) the following approach should work if you have jars you need in the classpath. String strTemplate = "data\jreport.jasper"; InputStream is = strTemplate.getClass().getResourceAsStream(strTemplate); JasperReport jdReport = JasperManager.loadReport(is); // Fill it with some data, using the parameters in your code. JasperPrint jdPrintOut = JasperFillManager.fillReport(jdReport, parameters, new JREmptyDataSource()); // Then try showing that in the viewer as you have done. try { new JasperViewer(jdPrintOut, false ); } catch (JRException e) { e.printStackTrace(); } 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