Jasper报告在Windows上正常工作,但在部署

时间:2016-07-27 10:56:11

标签: java ubuntu jasper-reports

我遇到了一个问题。我使用iReport 5.6.0开发了Jasper报告,我使用了NetBeans 8.0.2(JDK7 / 1.7)。我正在使用Windows 10.报告在开发机器上运行良好。虽然部署它在另一台具有java8(91)的Windows 10机器上工作正常,但它在Ubuntu(JDK7)机器上不起作用。它也不会抛出任何错误。我不确定它是Java问题还是与路径相关的问题。我也在使用子报告。在预览报告时查找以下代码:

    String sfilename="report";
    String path = "appname/" + sfilename + ".jasper";
    String imgp=("images"); //folder name under appl folder where images are stored

    InputStream reportName = this.getClass().getClassLoader().getResourceAsStream(path);

    HashMap param = new HashMap();
    param.put("param1","value1");
    param.put("param2","value2");
    param.put("imgpath",imgp); 
    param.put("SUBREPORT_DIR", "appname/"); 

    try {   
        JasperPrint jp = JasperFillManager.fillReport(reportName, param, conn);  // I observed under Ubuntu it is not going beyond this line

        net.sf.jasperreports.swing.JRViewer jv = new net.sf.jasperreports.swing.JRViewer(jp);

 //Insert viewer to a JFrame to make it showable
        JFrame jf = new JFrame();
        jf.getContentPane().add(jv);
        jf.validate();
        jf.setVisible(true);
        jf.setSize(new Dimension(800,600));
        jf.setLocation(300,100);
        jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        jf.setTitle("JASPER REPORT");

0 个答案:

没有答案