gpt4 book ai didi

java - JasperReports 错误 |尝试从Windows下的System32文件夹加载文件

转载 作者:太空宇宙 更新时间:2023-11-04 07:35:50 25 4
gpt4 key购买 nike

拥有一个使用DynamicReports(基于 Jasper 报表构建)的 Swing 应用程序来打印(显示和保存)pdf 文件。

应用程序在 Swing 应用程序的 Eclipse 调用中顺利运行,但在作为可执行 jar 运行时失败,给出 FileNotFoundException(访问被拒绝)

以下堆栈跟踪:

    C:\WINDOWS\system32\Report_1370232068590_862159.java
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperReport(JasperReportBuilder.java:278) ~[jar:rsrc:dynamicreports-core-3.1.3.jar!/:na]
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperPrint(JasperReportBuilder.java:308) ~[jar:rsrc:dynamicreports-core-3.1.3.jar!/:na]
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.export(JasperReportBuilder.java:596) ~[jar:rsrc:dynamicreports-core-3.1.3.jar!/:na]
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toPdf(JasperReportBuilder.java:516) ~[jar:rsrc:dynamicreports-core-3.1.3.jar!/:na]
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toPdf(JasperReportBuilder.java:512) ~[jar:rsrc:dynamicreports-core-3.1.3.jar!/:na]
at test.firewall.desktop.FirewallAccessTask.makeFirewallPIEChart(FirewallAccessTask.java:130) [rsrc:./:na]
at test.firewall.desktop.FirewallAccessTask.doInBackground(FirewallAccessTask.java:86) [rsrc:./:na]
at test.firewall.desktop.FirewallAccessTask.doInBackground(FirewallAccessTask.java:1) [rsrc:./:na]
at javax.swing.SwingWorker$1.call(Unknown Source) [na:1.7.0_21]
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [na:1.7.0_21]
at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.7.0_21]
at javax.swing.SwingWorker.run(Unknown Source) [na:1.7.0_21]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_21]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_21]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_21]
Caused by: net.sf.jasperreports.engine.JRException: Error saving expressions class file : C:\WINDOWS\system32\Report_1370232068590_862159.java
at net.sf.jasperreports.engine.util.JRSaver.saveClassSource(JRSaver.java:153) ~[jar:rsrc:jasperreports-5.0.4.jar!/:na]
at net.sf.jasperreports.engine.design.JRAbstractCompiler.getSourceFile(JRAbstractCompiler.java:310) ~[jar:rsrc:jasperreports-5.0.4.jar!/:na]
at net.sf.jasperreports.engine.design.JRAbstractCompiler.createCompileUnit(JRAbstractCompiler.java:282) ~[jar:rsrc:jasperreports-5.0.4.jar!/:na]
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:177) ~[jar:rsrc:jasperreports-5.0.4.jar!/:na]
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240) ~[jar:rsrc:jasperreports-5.0.4.jar!/:na]
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:490) ~[jar:rsrc:jasperreports-5.0.4.jar!/:na]
at net.sf.dynamicreports.jasper.builder.JasperReportBuilder.toJasperReport(JasperReportBuilder.java:275) ~[jar:rsrc:dynamicreports-core-3.1.3.jar!/:na]
... 14 common frames omitted
Caused by: java.io.FileNotFoundException: C:\WINDOWS\system32\Report_1370232068590_862159.java (Access is denied)
at java.io.FileOutputStream.open(Native Method) ~[na:1.7.0_21]
at java.io.FileOutputStream.<init>(Unknown Source) ~[na:1.7.0_21]
at java.io.FileOutputStream.<init>(Unknown Source) ~[na:1.7.0_21]
at java.io.FileWriter.<init>(Unknown Source) ~[na:1.7.0_21]
at net.sf.jasperreports.engine.util.JRSaver.saveClassSource(JRSaver.java:145) ~[jar:rsrc:jasperreports-5.0.4.jar!/:na]
... 20 common frames omitted

最佳答案

在此处输入代码看起来就像您的文件

C:\WINDOWS\system32\Report_1370232068590_862159.java没有读取权限。

授予权限:

rightclick on a file --> go to Properties --> security --> Edit --> Give your user permission for full control

我认为,这可能会解决您的问题。

关于java - JasperReports 错误 |尝试从Windows下的System32文件夹加载文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16889938/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com