Ola, quando eu chamo o relatorio n consigo salvar com extensao .pdf, apenas em rtf e htm e tambem quando eu fecho o relatorio toda a aplicacao eh fechada
[code]package relatorio.clientes;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.view.JasperViewer;
public class ClientesCadastrados {
private static Connection getConnection() throws
ClassNotFoundException, SQLException {
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/laboratorio";
String user = "root";
String password = "root";
Class.forName(driver);
Connection con = DriverManager.getConnection(url, user, password);
return con;
}
/* Gera Relatorio e visualiza-o */
public void geraRelatorio() throws JRException, Exception {
Connection con = getConnection();
Statement stm = con.createStatement();
String query = "select * from cliente";
ResultSet rs = stm.executeQuery(query);
HashMap parameters = new HashMap();
JasperPrint jp = JasperFillManager.fillReport("C:\\Documents and Settings\\Administrador\\Meus documentos\\projetos\\distribuidora\\src\\relatorio\\clientes\\ClientesCadastrados.jasper", parameters, con);
JasperViewer jrv = new JasperViewer(jp);
jrv.setVisible(true);
JasperViewer.viewReport("C:\\Documents and Settings\\Administrador\\Meus documentos\\projetos\\distribuidora\\src\\relatorio\\clientes\\ClientesCadastrados.pdf", true);
}
public static void main(String[] args) throws JRException, Exception {
new ClientesCadastrados().geraRelatorio();
}
}[/code]
e o comando que eu uso para chamar o relatorio no botao
try {
new relatorio.clientes.ClientesCadastrados().geraRelatorio();
} catch (JRException ex) {
Logger.getLogger(ClienteListagemForm.class.getName()).log(Level.SEVERE, null, ex);
} catch (Exception ex) {
Logger.getLogger(ClienteListagemForm.class.getName()).log(Level.SEVERE, null, ex);
}
espero que me ajudem
obrigado