Can't connect to X11 window server using ':0.0' as the value of the DISPLAY vari

第一次 error信息
 
java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
 
第二次以后
 
java.lang.NoClassDefFoundError
 
在google上搜索关键字Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable
 
原因
 
没安装x-window
 
顺便, 即使安装了x-window,也可能出现这种问题
未经验证的解决方法是
 
$ export DISPLAY=127.0.0.1:0.0
$ xhost +
 
 
对策
修正内容,增加以下变量
 JAVA_OPTS=-Djava.awt.headless=true
    或者 CATALINA_OPTS='-Djava.awt.headless=true'
修正方法
   用export或者etc/profile增加环境变量
   或者修改tomcat_home/bin下边的startup.sh或者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,tomcat,验证码不能显示)