How do I launch iReport-nb 3.xx from another Java application?
I would like to start using iReport (netbeans edition) and replace the good old classic iReport 3.0.x. It looks like the classic iReport will no longer be enhanced and abandoned at some point.
The thing is, I need to launch iReport from another Java application. With iReport 3.0 it was pretty simple and straightforward: just call it.businesslogic.ireport.gui.MainFrame.main(args);
and iReport is up and running.
The problem is I don't know how to do the same in iReport-nb. The netbeans framework is completely unknown to me and I couldn't find anything similar to the main method or starting point of the application. It seems to load a lot of network beans first and hide the iReport starting point somehow.
a source to share
iReport on NetBeans Platform works as a standalone application (just like the classic one) even though it can be installed and used as a NetBeans plugin. IR 3.5.2 will be released soon, it will cover all the remaining features present in iR classic that have not yet been covered in previous versions, but on the other hand, it provides many new features and support for JasperReports 3.5.2 including Complete new implementation of Barcode, List component (which are lightweight subheadings), new chart types, support for multiple ranges for details and group header / footer, inline view, and more.
Here you will find some tips on how to run NetBeans Platform applications from another Java application. Not trivial as you need to tweak the environment a bit, but definitely doable: http://wiki.netbeans.org/DevFaqPlatformAppAuthStrategies
Julio
Why do you think he refused? The latest version is 3.5.0, now by the way. And what are the reasons to change it to the netbeans version? Imho is the main application, which is still iReport, and the NetBean plugin functionality is similar to "plain old iReport".
And back to your question. iReport is a standalone application, and the "NetBeans version" is just a plugin, so you must start the NetBeans IDE and then switch its layout to the iReport plugin.
a source to share
1) Design: For report design, the idea is almost the same. After installing the plugin, create a new report and start designing. When you are done choosing a preview and iReport will compile your report, resulting in a .jasper file.
2) Run: write the code to transfer the data and start jajper from java code Something like this:
JasperPrint print=null;
ResultSet rs=null;
try {
Statement stmt = (Statement) myConnection.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE,//Default either way
ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery("select * from Table");
} catch (SQLException sQLException) {
}
try {
print = JasperFillManager.fillReport(filename, new HashMap(), new JRResultSetDataSource(rs));
} catch (JRException ex) {
}
try{
JRExporter exporter=new net.sf.jasperreports.engine.export.JRPdfExporter();
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, pdfOutFileName);
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
exporter.exportReport();
} ..........
a source to share