在linux上在画图和chart时好多人会碰到Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
原因:因为用到了图形处理,java程序会去寻找linux上的图形界面是否启动
解决:不让java寻找linux图形界面即可,在java启动时加选项java -Djava.awt.headless=true
实现:如果是tomcat,在/usr/local/tomcat/bin/catalina.sh中修改为
JAVA_OPTS=-Djava.awt.headless=true
echo "Using CATALINA_BASE: $CATALINA_BASE"
echo "Using CATALINA_HOME: $CATALINA_HOME"
echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR"
echo "Using RUNJAVA: $_RUNJAVA"
echo "Using JAVA_OPTS: $JAVA_OPTS"
java将不需检测,问题自然解决。