hello programmers. i really need some help with my code. i am trying to generate report from the database using the ireport plugin in netbeans. the problem is it keeps giving me an empty pdf file and also an empty jasperviewer. below is the code for the method.
  public void reportMethod(){
            try{
 
                 JasperDesign jasperDesign = JRXmlLoader.load("C:\\Users\\lami\\Documents\\NetBeansProjects\\placess\\src\\reports\\departments.jrxml");
 
                  String sql="SELECT * from departmentdata";
                  JRDesignQuery newQuery=new JRDesignQuery();
                  newQuery.setText(sql);
                  jasperDesign.setQuery(newQuery);
                 JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
 
                 JasperPrint jp=JasperFillManager.fillReport(jasperReport,null,con);
                 JasperExportManager.exportReportToPdfFile(jp, "c:/output/departments.pdf");
                 URL url = new URL("file:c:/output/departments.pdf");
                  Desktop.getDesktop().browse(url.toURI());
 
                 JasperViewer.viewReport(jp);
 
               // fr=new FReport();
               // fr.printPDFReport(null);
 
 
            }
 
            catch(Exception e){
 
                e.printStackTrace();
 
            }
 
        }

thanks great people!