我的swing应用程序在eclipse中运行得很好
但是当我将其导出到“可执行jar”时,尝试使用JasperReports
打印某些内容时会出现此异常:
Exception in thread "Thread-6" java.lang.ExceptionInInitializerError
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:97)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:74)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:62)
at net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(JRFiller.java:187)
at net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(JRFiller.java:202)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:110)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:584)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:930)
at smt.agm.launcher.SmartPaieLauncher$2.run(SmartPaieLauncher.java:94)
at java.lang.Thread.run(Unknown Source)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Input stream not found at : fonts.xml
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:188)
at net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.getExtensions(FontExtensionsRegistry.java:56)
at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensions(DefaultExtensionsRegistry.java:110)
at net.sf.jasperreports.engine.util.JRStyledTextParser.<clinit>(JRStyledTextParser.java:83)
... 10 more
Caused by: net.sf.jasperreports.engine.JRException: Input stream not found at : fonts.xml
at net.sf.jasperreports.repo.RepositoryUtil.getInputStreamFromLocation(RepositoryUtil.java:159)
at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:183)
为什么会这样?
编辑:
我在JasperReports
内使用ProjectX
,而这个ProjectX
在使用另一个Java项目,我们称之为ProjectY
在两个项目中,我正在使用JasperReports
jars
当我从JasperReports
中删除ProjectY
时,该异常不再存在。
这是什么解释?
以及如何在JasperReports
中使用ProjectY
?