在运行JasperViewer.viewReport(JasperPrint)方法时获取java.awt.HeadlessException [英] Getting java.awt.HeadlessException on running JasperViewer.viewReport(JasperPrint) method
问题描述
我在 Ubuntu 11 上运行此代码时收到错误:
I'm getting the error with this code running on Ubuntu 11:
JasperReport jasperReport = JasperCompileManager.compileReport("/resources/etiquetas/etiquetaEndereco.jrxml");
JasperPrint print = JasperFillManager.fillReport(jasperReport, parametros);
JasperViewer.viewReport(print);
Stack:
GRAVE: java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
at java.awt.Window.<init>(Window.java:432)
at java.awt.Frame.<init>(Frame.java:403)
at java.awt.Frame.<init>(Frame.java:368)
at javax.swing.JFrame.<init>(JFrame.java:158)
at net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:264)
我找不到此错误的解决方案。
I don't find solution for this error.
推荐答案
正如Java文档所示, java.awt.HeadlessException
是:
As Java documentation shows, java.awt.HeadlessException
is:
当依赖于键盘,显示器或鼠标的代码在不支持键盘,显示器或
鼠标的环境中调用
时抛出。
Thrown when code that is dependent on a keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse.
(来源)
和 java.awt.GraphicsEnvironment
:
GraphicsEnvironment
类描述$的集合b $ bGraphicsDevice
对象和Font
特定平台上的Java(tm)
应用程序可用的对象。
The
GraphicsEnvironment
class describes the collection ofGraphicsDevice
objects andFont
objects available to a Java(tm) application on a particular platform.
(来源)
检查您的报告源文件( etiquetaEndereco.jrxml
)正在调用无法在系统上安装的字体。
Check if your report source file (etiquetaEndereco.jrxml
) is calling fonts that could not be installed on your system.
这篇关于在运行JasperViewer.viewReport(JasperPrint)方法时获取java.awt.HeadlessException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!