java - 升级环境以将 JasperReports 与 Java 8 和新的 jdt 编译器一起使用后出现异常

标签 java java-8 jasper-reports eclipse-jdt

我想使用我的 jrxmlJava 代码生成 JasperReports 的报告。 我正在使用 Netbeans 8 和 jdk8。

我在模板编译过程中遇到了很多异常:

Exception in thread "main" net.sf.jasperreports.engine.JRException: 
Errors were encountered when compiling report expressions class file:
1. java.lang.Integer cannot be resolved or is not a type
                value = new java.lang.Integer(1); //$JR_EXPR_ID=0$
                                <--------------->
java.util.Date cannot be resolved or is not a type
                value = new java.util.Date(); //$JR_EXPR_ID=9$
                            <------------>
java.sql.Connection cannot be resolved or is not a type
                value = ((java.sql.Connection)parameter_REPORT_CONNECTION.getValue()); //$JR_EXPR_ID=21$
                          <----------------->

我已经添加了jdt jar 文件。

jar 文件的完整列表:

  • org.eclipse.jdt.core-3.7.1
  • jdtcore-3.1.0
  • org.eclipse.jdt.core-3.11.1.v20150902-1521
  • jasper-compiler-jdt-5.5.9
  • jtds-1.3.1
  • jdt-0.15.0

如何解决这个问题?

最佳答案

仅需要jasper-compiler-jdt-5.5.9.jar。上面列出的 .jar 文件不是必需的。 我添加了新的 jasper 库,但没有删除旧的 jar。 因此,请先删除旧的 jar,然后再添加最新版本的 jar。

关于java - 升级环境以将 JasperReports 与 Java 8 和新的 jdt 编译器一起使用后出现异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44382194/

相关文章:

java - 错误 : incompatible types: unexpected return value : Java 8

从列表中查找最大元素的java流性能

java - 将 jasperreport 导出为 .pdf 时如何设置 jasperreport 字体

format - 图表中的条件颜色更改

java - 为什么 'Arrays' 类的方法在 Java 中都是静态的?

java - 如何在 webView 中向网站添加 CSS(填充)

Java 命令有效,但 javac 命令无效

java - 找到未修补的 iText,无法使用字形渲染

java - 如何将字节数组转换为 ZIP 文件

java - 无法在测试服务器中使用 Java 发送电子邮件