Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
Hi, I am trying to run a JAVA class file and I keep getting the error below.
I have tried setting the display variable to: export DISPLAY=localhost:0.0 export DISPLAY=ipaddress:0.0, but no luck. I have also tried: [root@ds26 rick]# xhost + localhost xhost: unable to open display "" Can anyone explain to me what could be the reason. And why does the code even need this to run? The code works fine on a Windows machine. Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'localhost:0.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 sun.awt.motif.MToolkit.<clinit>(MToolkit.java:81) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at java.awt.Toolkit$2.run(Toolkit.java:748) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:739) at javax.swing.ImageIcon.<init>(ImageIcon.java:81) at javax.swing.ImageIcon.<init>(ImageIcon.java:107) at PicResizer.resizePic(PicResizer.java:41) at PicResizer.<init>(PicResizer.java:30) at PicResizer.main(PicResizer.java:92) |
What distro, which version of X, .... ?
Xandros for instance have managed to bend XFree in such fashion that the "normal" (the things you tried) way of doing this doesn't work anymore. This, how ever, works: export DISPLAY=:0 Cheers, Tink |
With a bit of digging I have found the solution. It seems that on LINUX and UNIX, Java products need access to the Java.AWT library to run graphic related methods.
Most versions of the Java.AWT library on UNIX require a functioning X server. The X server and the DISPLAY environment variable also needs to be correctly set. Here is what I did in case anybody else comes across this problem: I installed the Xvfb rpm (X virtual frame buffer) and added these lines to the /etc/profile file... # Start the X virtual frame buffer (Xvfb) if [ -f /usr/X11R6/bin/Xvfb ]; then /usr/X11R6/bin/Xvfb :1 -screen 0 1024x768x16 fi # Set the DISPLAY variable for the X virtual frame buffer (Xvfb) export DISPLAY=localhost:1.0 |
You never mentioned the machine isn't
running X ;} Cheers, Tink |
Quote:
|
export DISPLAY=:0 fixed the problem for me on RHEL 4.
|
# xhost + worked for me
|
Thanks.
Thanks . It works fine.
Regards Shweta Quote:
|
Oracle 10g on CentOS 5.5 X11 error
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source) at java.awt.Window.init(Unknown Source) at java.awt.Window.<init>(Unknown Source) at java.awt.Frame.<init>(Unknown Source) at oracle.ewt.popup.PopupFrame.<init>(Unknown Source) at oracle.ewt.lwAWT.BufferedFrame.<init>(Unknown Source) at oracle.sysman.oio.oioc.OiocOneClickInstaller.<init>(OiocOneClickInstaller.java:378) at oracle.sysman.oio.oioc.OiocOneClickInstaller.main(OiocOneClickInstaller.java:2091) |
X connection to localhost:11.0 broken (explicit kill or server shutdown)
|
I remember I had such troubles because of permission problems, if X started from root and I try to start java from user, or vice verse. Try to start java from user that own this X DISPLAY socket, or find a way to change this socket access rights.
|
Quote:
Code:
export DISPLAY=":0.0" Code:
xhost +local:all Code:
xhost +inet:192.168.3.5 |
xhost +local:all is worked for me in centos virtual machine.
Thanks |
I received the same errors as mentioned above...this is what worked for me (no quotes):
>export DISPLAY="IP Address":0.0 |
Hello,
I'm getting this error, when I submit a test in linux machine. the linux machine is picked randomly. So I will not know the ip address. Request your help to get it resolved. |
All times are GMT -5. The time now is 07:40 PM. |