[color=darkred]错误提示[/color]:Error: Can't open display: :0.0
[[color=red]root[/color]@shihuan ~]# yum install xorg-x11-apps
[[color=red]root[/color]@shihuan ~]# xhost +
[[color=red]root[/color]@shihuan ~]# xclock
这时[color=red]root[/color]用户已经可以调用xclock了。
[[color=red]root[/color]@shihuan ~]# su - [color=blue]tomcat[/color]
【[color=blue]注[/color]】如果是[color=brown]redhat6[/color]系列的操作系统,则此时调用xclock已经可以成功了,但在[color=brown]redhat7[/color]系列操作系统中会报不能打开DISPLAY的错误。
在[color=brown]redhat7[/color]系列操作系统下分两种模式:
1、在Windows的xshell中调用
2、在RedHat7图形化界面系统内部
如果是在Windows的xshell中调用xclock,则需要先执行如下命令:
[[color=red]tomcat[/color]@shihuan ~]# export DISPLAY=Windows_IP:0.0
[[color=red]tomcat[/color]@shihuan ~]# xclock
此时在xshell中已经可以成功调用xclock了。
如果是在RedHat7图形化界面系统内部调用xclock,则需要先执行如下命令:
[[color=red]tomcat[/color]@shihuan ~]# export DISPLAY=:0.0
[[color=red]tomcat[/color]@shihuan ~]# xclock
此时在RedHat7图形化界面系统内部已经可以成功调用xclock了。
【注】RedHat6和RedHat7还是有一些差别的, :arrow: 。
[[color=red]root[/color]@shihuan ~]# yum install xorg-x11-apps
[[color=red]root[/color]@shihuan ~]# xhost +
[[color=red]root[/color]@shihuan ~]# xclock
这时[color=red]root[/color]用户已经可以调用xclock了。
[[color=red]root[/color]@shihuan ~]# su - [color=blue]tomcat[/color]
【[color=blue]注[/color]】如果是[color=brown]redhat6[/color]系列的操作系统,则此时调用xclock已经可以成功了,但在[color=brown]redhat7[/color]系列操作系统中会报不能打开DISPLAY的错误。
在[color=brown]redhat7[/color]系列操作系统下分两种模式:
1、在Windows的xshell中调用
2、在RedHat7图形化界面系统内部
如果是在Windows的xshell中调用xclock,则需要先执行如下命令:
[[color=red]tomcat[/color]@shihuan ~]# export DISPLAY=Windows_IP:0.0
[[color=red]tomcat[/color]@shihuan ~]# xclock
此时在xshell中已经可以成功调用xclock了。
如果是在RedHat7图形化界面系统内部调用xclock,则需要先执行如下命令:
[[color=red]tomcat[/color]@shihuan ~]# export DISPLAY=:0.0
[[color=red]tomcat[/color]@shihuan ~]# xclock
此时在RedHat7图形化界面系统内部已经可以成功调用xclock了。
【注】RedHat6和RedHat7还是有一些差别的, :arrow: 。