Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have Eclipse Juno installed on Ubuntu 12.04.

When I run from the command line with sudo, everything works fine. However, when I follow the advice I see everywhere and run it with gksudo, I get the following exception whenever I to run anything with a GUI:

No protocol specified
No protocol specified
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.access$100(X11GraphicsEnvironment.java:52)
    at sun.awt.X11GraphicsEnvironmNent$1.run(X11GraphicsEnvironment.java:155)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:131)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
    at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:89)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at java.awt.Toolkit$2.run(Toolkit.java:834)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826)
    at java.awt.Toolkit.getEventQueue(Toolkit.java:1689)
    at java.awt.EventQueue.invokeLater(EventQueue.java:1032)
    at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1267)
    at codetests.DialogTest.main(DialogTest.java:72)

What do I need to change so I can run with gksudo and have this work?

share|improve this question
What advice do you see everywhere? It may help you get an answer if you run through the steps. –  Magpie May 1 '13 at 0:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.