Top
首页 > 老文章 > 正文

Linux上 Can't connect to X11 window server 错误解决方法

Linux上 Can't connect to X11 window server 错误解决方法

Linux上 Can't connect to X11 window server 错误解决方法
发布时间:2006-03-10 01:50        来源:        作者:

Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'localhost:11.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
at java.awt.Font.initializeFont(Font.java:308)
at java.awt.Font.<init>(Font.java:344)
at org.jfree.chart.axis.AxisConstants.<clinit>(Unknown Source)
at org.jfree.chart.axis.Axis.<init>(Unknown Source)
at org.jfree.chart.axis.CategoryAxis.<init>(Unknown Source)
at org.jfree.chart.ChartFactory.createLineChart(Unknown Source)

我做了一个验证码图片自动生成器,windows上正常;linux上就报以上错误

原因是windows内核集成了gui,而linux上没有启动x server

解决办法:

1。启动x server

2。在java运行参数上加-Djava.awt.headless=true

问题解决,大家可以看我的验证图片:http://www.youkone.com/authImage.ww


 

加载更多

专题访谈

合作站点
stat