This is just a short tutorial on how to code / call / invoke iReport from Java Application using netbeans, i created this tutorial for my Java class and i would like to share this with everyone. i hope you will understand the short video clip i created for this one.
Here is the link where you can download the required jar files for your project.
I recommend you watch this video in fullscreen and in HD..
Here is the source code :
[code language="java"]
/**
*
* @author joeLL
*/
import java.sql.*;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.swing.JRViewer;
import javax.swing.*;
public class ReportView extends JFrame
{
Connection conn = null;
void showReport()
{ try
{
//database connection here
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn =DriverManager.getConnection( "jdbc:odbc:joell" );
JasperReport report = JasperCompileManager.compileReport("report1.jrxml");
JasperPrint print = JasperFillManager.fillReport(report,null, conn);
JRViewer viewer = new JRViewer(print);
viewer.setOpaque(true);
viewer.setVisible(true);
//make your JFrame visible
this.add(viewer);
this.setSize(300,200);
this.setVisible(true);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
catch(Exception ex)
{
System.out.println("CAUSE: " + ex.getCause());
System.out.println("MESSAGE" + ex.getMessage());
System.out.println("LOCAL MESSAGE" + ex.getLocalizedMessage());
ex.printStackTrace();
}
}
public static void main(String args[])
{
new ReportView().showReport();
}
}
[/code]
you may place your comments or questions below and i will try my best to answer those questions.
Incoming search terms:
- call ireport from java application
- JasperFillManager fillReport
- JasperCompileManager compileReport
- ireport java
- net sf jasperreports engine JRException: com sun org apache xerces internal impl io MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence
- tuto java/ireport
- java lang NoClassDefFoundError: org/apache/commons/digester/Digester
- how to call ireport from java
- filenotfoundexception when calling ireport in java application
- how to call ireport from java application
