Possible Duplicate:Open a window on a remote X display (why “Cannot open display”)? I have a script that when run independently works that needs X11 Display variables to be set.When I invoke this script using a background daemon job, I get the following error.Xlib: connection to localhost.localdomain:0.0 refused by serverXlib: No protocol specifiedPlease help me identifying the possible mistake that I have in this. Commands given below which is inside the script.export DISPLAY=hostname:0.0java ScreenCapture If the same script is invoked by a background daemon running as a service, I get the error. 
Xlib: No protocol specified
linux;x11;display