这个时候一个解决方法是登陆一个 CDE ,在 CDE 下打开 Console ,查找环境变量 DISPLAY 如下:
[root@isoft /root]# set |grep DISPLAY
DISPLAY=10.67.85.7:0.0
10.67.85.7 表示客户端的 IP,0.0 表示连入的第一个 CDE。
有了这个 X 的客户端,便可以在连接这个服务器的其他客户端使用这些图形相关包了,使用方式如下,在 shell下指定一个 DISPLAY :
[root@isoft /root]# DISPLAY=10.67.85.7:0.0
[root@isoft /root]# export DISPLAY
此时运行程序可能会出现的编译错误如下:
java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName0(Compiled Code)
at java.lang.Class.forName(Compiled Code)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:63)
at TestServlet.service(TestServlet.java:16)Unfortunately, this error message is somewhat misleading. This message does not actually reflect a class loading problem. The error can be avoiding by setting the DISPLAY environment variable in the appropriate configuration file.
这时要修改应用服务器的启动参数 以resin 为例: vi $RESIN_HOME/binhttpd.sh,找
到args所在的行,修改, args=-Djava.awt.headless=true,重新启动Resin就OK
iReport 加 jasper 问题及解决办法
最新推荐文章于 2022-08-02 16:07:49 发布
一 当遇到 java.lang.InternalError: Can’t connect to X11 window server using ’:0.0’ as the value of the DISPLAY variable 错误信息