1

When I start cygwin/X X Server (1.17.1-2) and then putty with x11 forwarding enabled (X display location set to localhost:10.0 and MIT-Magic-Cookie-1 ticked) I still get the error

    Startup Error: Unable to detect graphics environment

when I try to start any program (e.g. pycharm). Neither on my windows machine, nor on my linux box I have the DISPLAY variable set. When I hover over the cygwin icon in the tray on windows, it shows cygwin x server :0.0, so I tried both export DISPLAY=:0.0 on my windows and linux machine. But then I get

Start Failed: Failed to initialize graphics environment

java.awt.AWTError: 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$200(X11GraphicsEnvironment.java:65)
        at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
        at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:128)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at java.awt.Toolkit$2.run(Toolkit.java:860)
        at java.awt.Toolkit$2.run(Toolkit.java:855)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
        at com.intellij.ui.AppUIUtil.updateFrameClass(AppUIUtil.java:155)
        at com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:94)
        at com.intellij.idea.MainImpl.start(MainImpl.java:20)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.intellij.ide.plugins.PluginManager.lambda$start$0(PluginManager.java:75)
        at java.lang.Thread.run(Thread.java:745)

I have tried all sorts of combinations (DISPLAY=:0) removing the X display location in putty but doesnt help

setup:

  • The linux box is a Red Hat Enterprise Linux Server release 6.6 (Santiago)
  • Windows is Windows 7 Enterprise 64-bit
  • Putty is version 0.68 release Compiler: Visual Studio 2015 / MSVC++ 14.0 (_MSC_VER=1900)

Thanks

2

You need to start startxwin with the option -listen . For example my shortcut is :

C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; exec /usr/bin/startxwin -- -listen tcp"

https://sourceware.org/ml/cygwin-announce/2015-04/msg00050.html

'-nolisten tcp' is now the default, so the server only accepts local connections on a unix domain socket. A '-listen' option has been added which can be used to restore the previous behaviour.

  • I set -listen tcp in xlaunch config (as recommended here blog.woopi.org/wordpress/?p=293) but when I start putty after cygwin, just enable X11 forwarding (no X-display location) and connect to the linux server it still tells me Start Failed: Failed to initialize graphics environment. Do I need to set the DISPLAY variable (I tried some combinations like :0 and :10 but that just results in java.awt.AWTError: Can't connect to X11 window server using... – tenticon Aug 23 '18 at 10:22
  • DISPLAY=:0 works on the same computer. You need to add the IP address for connection from a different one DISPLAY=your_cygwin_ip:0 – matzeri Aug 23 '18 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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