Pycharm Startup Error: Unable to detect graphics environment

Joseph Wahba picture Joseph Wahba · Sep 8, 2017 · Viewed 40.7k times · Source

I'm trying to setup Pycharm professional edition on Fedora 25 x64. After downloading the files and extracting them, I'm trying to run the script ./pycharm.sh in the bin directory. This is the error I get:

Startup Error: Unable to detect graphics environment

I have checked my Java version

[root@localhost bin]# java -version
openjdk version "1.8.0_144"
OpenJDK Runtime Environment (build 1.8.0_144-b01)
OpenJDK 64-Bit Server VM (build 25.144-b01, mixed mode)

I tried as well to set the DISPLAY variable:

export DISPLAY=:0 

And this is what I get:

[root@localhost bin]# ./pycharm.sh 
No protocol specified

Start Failed: Failed to initialize graphics environment

java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.

Any suggestions please ?

Answer

mightypile picture mightypile · Oct 21, 2017

I had the same error installing in a clean Ubuntu 17.10, with Gnome on Wayland. At @mattdm's suggestion in your comments, I just opened a new terminal (as myself, not root) and it ran fine. I was running as root (after unpacking everything to /opt/) when I got the error.

mike@feynman:~$ /opt/pycharm/bin/pycharm.sh

Once you register/activate, just click the "* Configure v" pulldown from the welcome window, and select "Create Desktop Entry" to make it available from your OS menus. I'm assuming JetBrains made this work for whichever linux flavor you prefer.