Error: Can't connect to X11 window server using ':0.0'

3,135 views
Skip to first unread message

santosh kumar chaudhari

unread,
Mar 23, 2009, 4:55:26 AM3/23/09
to linuxus...@googlegroups.com
Hi guys,
I am using fedora 9. From last 1 week I am facing X11 error for running Java application. when I am running java GUI application on Netbeans i am getting the following error :

No protocol specified
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
        at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
        at sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:60)
        at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:164)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:140)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
        at java.awt.Window.init(Window.java:385)
        at java.awt.Window.<init>(Window.java:438)
        at java.awt.Frame.<init>(Frame.java:419)
        at java.awt.Frame.<init>(Frame.java:384)
        at javax.swing.JFrame.<init>(JFrame.java:180)
        at applicationsetting.ApplicationSetup.<init>(ApplicationSetup.java:17)
        at applicationsetting.Main.main(Main.java:19)
Java Result: 1

I did google searching but every where i got three suggestion.
a) export DISPLAY=:0.0
b) export DISPLAY=:1.0
c) export DISPLAY=:<IP>.0

But none of the above is working for me. I reinstalled X11 org packages but still same error.
Along with this problem another problem is when i am running command
su -
after entering password it taking long time to get root prompt. I don't know either its related to X11 or not. But I have temporary solution for this. I running init 4 and then starting startx, the response again coming into normal state. But i need permanent solution for this.
You guys can help me out to solve these two problem.

--thanks & regards
--santosh

Abishek Goda

unread,
Mar 23, 2009, 11:41:36 PM3/23/09
to linuxus...@googlegroups.com
Is this happening only within netbeans? Are you able to start X based
apps from the console/terminal? Did you try running the java program
outside of netbeans?

Regards,

Abishek Goda
http://abishek.zxq.net

santosh kumar chaudhari

unread,
Mar 23, 2009, 11:57:58 PM3/23/09
to linuxus...@googlegroups.com
Hi,
In case of Java application this error is coming in netbeans as well as also in command console, when i am running command "java -jar appl.jar". But when i am just clicking on app then its running without any problem. Same X11 Display error is comming for other configuration tools like system-config-network, services etc.
The error for system-config-network is as
"[root@ids ~]# system-config-network
No protocol specified
ERROR: Unable to initialize graphical environment. Most likely cause of failure is that the tool was not run using a graphical environment. Please either start your graphical user interface or set your DISPLAY variable.
[root@ids ~]# "

--santosh

Abishek Goda

unread,
Mar 23, 2009, 11:59:35 PM3/23/09
to linuxus...@googlegroups.com
Are you working as root? Did you login from gdm/kdm/xdm as root?

Regards,

Abishek Goda
http://abishek.zxq.net



On Tue, Mar 24, 2009 at 9:27 AM, santosh kumar chaudhari

santosh kumar chaudhari

unread,
Mar 24, 2009, 12:04:03 AM3/24/09
to linuxus...@googlegroups.com

I login from gdm.

Abishek Goda

unread,
Mar 24, 2009, 12:07:22 AM3/24/09
to linuxus...@googlegroups.com
Good. But do you login as root?

Regards,

Abishek Goda
http://abishek.zxq.net



On Tue, Mar 24, 2009 at 9:34 AM, santosh kumar chaudhari

santosh kumar chaudhari

unread,
Mar 24, 2009, 12:10:56 AM3/24/09
to linuxus...@googlegroups.com

No, i login as a normal user and used su - command to get root prompt. I need to run system-config-network. So i am using root prompt.

Abishek Goda

unread,
Mar 24, 2009, 12:14:07 AM3/24/09
to linuxus...@googlegroups.com
When you do su -, it is unlikely that the display permissions
retained. By default, only the logged in user has permissions to
launch X apps. When you do su, the display permissions may still hold.
Try this

As normal user, type xhost +
And then do you su - and test the commands.

Regards,

Abishek Goda
http://abishek.zxq.net



On Tue, Mar 24, 2009 at 9:40 AM, santosh kumar chaudhari

santosh kumar chaudhari

unread,
Mar 24, 2009, 12:18:23 AM3/24/09
to linuxus...@googlegroups.com
Hi,
 Thanks a lot. Now there is no error for running gui application.

--santosh

Abishek Goda

unread,
Mar 24, 2009, 12:20:05 AM3/24/09
to linuxus...@googlegroups.com
One thing. Its a bad idea to do xhost +, it essentially removes all
access controls on the display. I am not sure what goes vulnerable
there.

Secondly, it is an even more bad idea to build apps as root. Many
things that work for root wont work as normal users..

Just a tip.
Regards,

Abishek Goda
http://abishek.zxq.net



On Tue, Mar 24, 2009 at 9:48 AM, santosh kumar chaudhari

Kumar Appaiah

unread,
Mar 24, 2009, 12:28:59 AM3/24/09
to linuxus...@googlegroups.com
I usually never nitpick about top posting, but in this thread, I'll
just make a request to at least trim mails before sending them... for
the mail in which the OP thanked Abhishek was 17 KB. For a mere "thank
you", that is very big!

Thanks.

Kumar
--
:
####[ GNU/Linux One Stanza Tip (LOST) ]#######################

Sub : Removing duplicates from bash history LOST #727

If you have typed the same command (say "pine" or "lynx")
several times - only one copy of that command gets saved
in the command history: 'export HISTCONTROL=ignoredups'

####[linux (at) frodo.hserus.net]#############################
:

Abishek Goda

unread,
Mar 24, 2009, 12:32:32 AM3/24/09
to linuxus...@googlegroups.com
Sorry Kumar,


> I usually never nitpick about top posting, but in this thread, I'll
> just make a request to at least trim mails before sending them... for
> the mail in which the OP thanked Abhishek was 17 KB. For a mere "thank
> you", that is very big!
>

Gmail tends to make habits a bit loose ;-)

Kumar Appaiah

unread,
Mar 24, 2009, 8:30:21 AM3/24/09
to linuxus...@googlegroups.com
On Tue, Mar 24, 2009 at 10:02:32AM +0530, Abishek Goda wrote:
> > I usually never nitpick about top posting, but in this thread, I'll
> > just make a request to at least trim mails before sending them... for
> > the mail in which the OP thanked Abhishek was 17 KB. For a mere "thank
> > you", that is very big!
> >
>
> Gmail tends to make habits a bit loose ;-)

I know. I also _hate_ mailing lists with GMail.

Kumar
--
:
####[ GNU/Linux One Stanza Tip (LOST) ]#######################

Sub : pr : text printing utility [#1] LOST #679

pr - paginates or columnates text files for printing. To print
a numbered list of all files in the current directory:
$ ls -a | pr -n -h "Files in $(pwd)."

####[ ajitabhpandey (at) users.sourceforge.net ]##############
:

Vimal

unread,
Mar 24, 2009, 9:06:17 AM3/24/09
to linuxus...@googlegroups.com
2009/3/24 Kumar Appaiah <kumar....@gmail.com>:

>
> I know. I also _hate_ mailing lists with GMail.
>

Are there other reasons besides people getting carried away with their
old habits and frequently top posting :)

--
Vimal

Reply all
Reply to author
Forward
0 new messages