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

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

1 Answer 1

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

 
discard

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.