Eu tenho a seguinte classe para chamar o relatório mas ele não aparece :
[code]public class Relatorio {
public Relatorio() {
try {
abreRelatorio();
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void abreRelatorio() throws JRException, Exception{
Map parameters = new HashMap( );
// parameters.put(“DATA_INICIAL”,dataInicial);
// parameters.put(“DATA_FINAL”,dataFinal);
parameters.put(“Nome”, new String());
String path = “C:/Documents and Settings/Desenvolvimento/Desktop/Relatorio.jasper”;
System.out.println(“Teste de jsp”);
File file = new File(path);
file = file.getAbsoluteFile( );
String repStr2 = file.getPath( );
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
String url = "jdbc:odbc:academico";
String userName = "sa";
String password = "154264";
String query = "SELECT * FROM Aluno";
Connection con= DriverManager.getConnection(url, userName, password);
Statement statement = con.createStatement();
ResultSet resultSet = statement.executeQuery(query);
JasperFillManager.fillReportToFile( repStr2, parameters, con );
JasperPrint jasperPrint = JasperFillManager.fillReport(repStr2,parameters,con);
JasperViewer viewer = new JasperViewer(jasperPrint, true);
}
catch(JRException jex){
jex.getMessage( );
}
catch(Exception ex){
ex.getStackTrace( );
}
}
public static void main(String[] args) throws JRException, Exception{
Relatorio rel=new Relatorio();
rel.abreRelatorio();
}
}
[/code]