Bom galera eu sou iniciantes em java e estou com um problema com relatorios.
criei um relatorio no ireport deu tudo certo, mas na hora de colocar na aplicação não consigo
tenho uma class para o relatorio:
package cartorio;
import java.sql.<em>;
import javax.swing.JOptionPane;
import java.util.HashMap;
import net.sf.jasperreports.engine.</em>;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.*;
public class RelatorioProdutos {
private Connection con;
private String relatorio = getClass().getResource("classic.jrxml").getPath();
public RelatorioProdutos() {
try{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(
"jdbc:mysql://localhost/casa2",
"root",
"");
}
catch(ClassNotFoundException erro){
JOptionPane.showMessageDialog(null, "Erro: " + erro.getMessage());
}
catch(SQLException erro){
JOptionPane.showMessageDialog(null, "Erro: " + erro.getMessage());
}
}
public void exibirRelatorio(){
try {
JasperReport jr = (JasperReport)JRLoader.loadObject(relatorio);
HashMap map = new HashMap();
JasperPrint rel = JasperFillManager.fillReport(jr, map, con);
JasperViewer.viewReport(rel, false);
} catch (JRException erro) {
JOptionPane.showMessageDialog(null, "Erro: " + erro.getMessage());
}
}
}
abaixo é meu relatorio:
<?xml version="1.0" encoding="UTF-8" ?>
<queryString><![CDATA[SELECT
tabela.`nome` AS tabela_nome,
tabela.`tel` AS tabela_tel
FROM
tabela tabela]]>
<field name="tabela_nome" class="java.lang.String"/>
<field name="tabela_tel" class="java.lang.String"/>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="50" isSplitAllowed="true" >
<staticText>
<reportElement
x="61"
y="5"
width="412"
height="40"
forecolor="#000000"
backcolor="#FFFFFF"
key="staticText"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Center">
<font size="30"/>
</textElement>
<text><![CDATA[Classic Report Template]]></text>
</staticText>
<line direction="TopDown">
<reportElement
x="0"
y="48"
width="534"
height="0"
key="line"/>
<graphicElement stretchType="NoStretch"/>
</line>
<line direction="TopDown">
<reportElement
x="0"
y="3"
width="534"
height="0"
key="line"/>
<graphicElement stretchType="NoStretch"/>
</line>
</band>
</title>
<pageHeader>
<band height="10" isSplitAllowed="true" >
<line direction="BottomUp">
<reportElement
x="0"
y="9"
width="535"
height="0"
key="line"/>
<graphicElement stretchType="NoStretch"/>
</line>
</band>
</pageHeader>
<columnHeader>
<band height="0" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="50" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="127"
y="2"
width="398"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{tabela_nome}]]></textFieldExpression>
</textField>
<staticText>
<reportElement
x="0"
y="2"
width="267"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="staticText"
positionType="Float"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[Nome:]]></text>
</staticText>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="127"
y="21"
width="398"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{tabela_tel}]]></textFieldExpression>
</textField>
<staticText>
<reportElement
x="0"
y="21"
width="267"
height="17"
forecolor="#000000"
backcolor="#FFFFFF"
key="staticText"
positionType="Float"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="12"/>
</textElement>
<text><![CDATA[Telefone:]]></text>
</staticText>
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="27" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="325"
y="4"
width="170"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="499"
y="4"
width="36"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="10"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<line direction="TopDown">
<reportElement
x="0"
y="3"
width="535"
height="0"
key="line"/>
<graphicElement stretchType="NoStretch"/>
</line>
<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="1"
y="6"
width="209"
height="19"
forecolor="#000000"
backcolor="#FFFFFF"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font size="10"/>
</textElement>
<textFieldExpression class="java.util.Date"><![CDATA[new Date()]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="0" isSplitAllowed="true" >
</band>
</summary>
quando eu chamo a class do relatorio dar um erro:java.io.filenotfoundexcpition
porfavor me ajude