首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >如何在java中修复NoClassDefFoundError

如何在java中修复NoClassDefFoundError
EN

Stack Overflow用户
提问于 2013-10-02 18:14:27
回答 1查看 123关注 0票数 0

这是我的来源线打印我的发票页。我的报告不在java包中。我将它保存在一个名为"report“的文件夹中,该文件夹位于与我的java项目相同的分区中。现在我有NoClassDefFoundError了。

代码语言:javascript
代码运行次数:0
运行
复制
try {
    String date1 = new SimpleDateFormat("yyyy-MM-dd").format(isdate.getDate());
    String time1 = istime.getValue().toString().split(" ")[3];
    date1 = date1 + " " + time1;

    String date2 = new SimpleDateFormat("yyyy-MM-dd").format(redate.getDate());
    String time2 = retime.getValue().toString().split(" ")[3];
    date2 = date2 + " " + time2;

    JRTableModelDataSource dataSource = new JRTableModelDataSource(jTable1.getModel());
    String reportsource = " D://report/report1.jrxml";
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("inid", txtInvoiceID.getText());
    params.put("cuname", txtCuName.getText());
    params.put("cuadd", txtCuid.getText());
    params.put("cutp", txtTPNo.getText());
    params.put("isdate", date1);
    params.put("redate", date2);
    params.put("advance", txtAdvance.getText());
    params.put("due", txtDue.getText());
    params.put("total", txtGtotal.getText());
    JasperReport jasperReport = JasperCompileManager.compileReport(reportsource);
    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource);
    JasperViewer.viewReport(jasperPrint, false);
    JOptionPane.showMessageDialog(null, "Done");
} catch (Exception e) {
    System.out.println(e);
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-10-02 18:18:58

编译器在编译时找到必要的库,但是程序无法在运行时在类路径中找到它们。将Jasper库添加到您的类路径。(我有它的受抚养人。)它们中的大多数都是)

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19143867

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档