3

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?

  • What advice do you see everywhere? It may help you get an answer if you run through the steps. – Magpie May 01 '13 at 00:30

1 Answers1

0

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.

A.B.
  • 90,397