Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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(
    at sun.awt.X11GraphicsEnvironmNent$
    at Method)
    at sun.awt.X11GraphicsEnvironment.<clinit>(
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(
    at sun.awt.X11.XToolkit.<clinit>(
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(
    at java.awt.Toolkit$
    at Method)
    at java.awt.Toolkit.getDefaultToolkit(
    at java.awt.Toolkit.getEventQueue(
    at java.awt.EventQueue.invokeLater(
    at javax.swing.SwingUtilities.invokeLater(
    at codetests.DialogTest.main(

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

There is and there was never a reason to start Eclipse with administrator privileges.

Place your Eclipse application folder in /opt and grant read access.

sudo chmod -R +r /opt/eclipse

All user files, workspace etc. are stored in your home folder.

More about Eclipse here.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.