Pycharm Startup Error: Unable to detect graphics environment - linux

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 ?

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.

Your X environment is not properly set (manually setting DISPLAY doesn't always work). Possibly because you're attempting this as root and root is not the owner of the graphics session. There could be other reasons, too.
You won't be able to run xclock or any other X app either in this situation - this is the clue that it's not a pycharm-related problem. For example if you ssh to localhost as root, not as the user currently logged in into the graphical session:
laptop:~ # ssh localhost
Password:
Last login: Thu Nov 23 22:19:06 2017 from localhost
Have a lot of fun...
laptop:~ # export DISPLAY=:0
laptop:~ # xclock
No protocol specified
Error: Can't open display: :0
laptop:~ # konsole
No protocol specified
Segmentation fault
laptop:~ # pycharm
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0
No protocol specified
Start Failed: Failed to initialize graphics environment
You'd also see the same behaviour if you attempt the same in a text-mode console.
To address this issue open a new terminal from the graphics environment - if it is properly installed you should be able to run any of the X apps, including pycharm (or at least it shouldn't fail with that error).

In fedora
I have installed pycharm using fedy. This is worked.
Or change to a another user and try except root.
Phpstrom, Webstrom, PyCharm
Above three of them worked same like that.

In my case I am runing pycharm through docker, which is different host, run command xhost + , this would disable access control and client would be able to connect from any host.

Try running the program from another user instead of root. It worked for me.

I used OpenJDK instead of Oracle Java, because PyCharm hangs on Raspberry Pi.
In the file /etc/java-8-openjdk/accessibility.properties, disabling the entry assistive_technologies (simply comment out with a #) solved the issue.

This is what resolved my issue:
export DISPLAY='localhost:11'

Related

Why can't I install WebStorm on Linux Fedora 27?

I want to install WebStorm on Fedora 27. I start ./webstorm.sh but it doesn't work.
How can I solve this problem?
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.
Java.AWT library requires X11 GUI environment to work. Do you work on your Linux workstation directly, or access it remotely? Also, what JDK do you run WebStorm with? make sure that it has the graphical libraries included.
See also this link for more info
try this first:
$ chmod +x ./webstorm.sh
and then
$ ./webstorm.sh

How to install DCEVM for Java 7 in Linux?

The main site of DCEVM didn't clearly explain how to install DCEVM on Linux. Running "java -jar installer.jar" in Linux (when accessed via PuTTy) gave me the following exception.
[admin#LINUXBOX jdk1.7.0_55]$ java -jar DCEVM-full-7u79-installer.jar
java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
at java.awt.Window.<init>(Window.java:535)
at java.awt.Frame.<init>(Frame.java:420)
at javax.swing.JFrame.<init>(JFrame.java:224)
at com.github.dcevm.installer.MainWindow.<init>(MainWindow.java:43)
at com.github.dcevm.installer.Main.main(Main.java:46)
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
at java.awt.Window.<init>(Window.java:535)
at java.awt.Frame.<init>(Frame.java:420)
at java.awt.Frame.<init>(Frame.java:385)
at javax.swing.SwingUtilities$SharedOwnerFrame.<init>(SwingUtilities.java:1757)
at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1832)
at javax.swing.JOptionPane.getRootFrame(JOptionPane.java:1697)
at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:863)
at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:667)
at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:638)
at com.github.dcevm.installer.Main.main(Main.java:51)
If required, I am also ready to use a Virtual Box installed Desktop Linux to try it, which then I can copy (patched JDK) into my original Linux box thereafter.
So, how can I install DCEVM on Linux (for Java 7)? Do I need a Desktop-based Linux for that?
EDIT:
Here's the output of few commands suggested by the first answer by Sharad:
[admin#TESTBEDPEGSEARCH jdk1.7.0_55]$ echo $DISPLAY
[admin#TESTBEDPEGSEARCH jdk1.7.0_55]$ java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
EDIT2:
I am using DCEVM in Windows for quite a long time.
echo $DISPLAY should print :0 . If it is not printing :0 Then you should set display variable using this command "export DISPLAY=127.0.0.1:0.0" . I hope it will work
Step 1:--Check for the display variable set on your machine using echo
echo $DISPLAY
ensure It is set on :0
Step 2:-Check for your JAVA version Using
java -version
My Centos machine is reflecting:--
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
Step 3:-- I run java -jar DCEVM-full-7u79-installer.jar command
It works for me.
The DISPLAY variable is only set when a X11 session is active. When you login on a remote machine with ssh, this usually is not the case.
There are two possible solutions:
install a X server on Windows (e.g. XMing) and enable X11 forwarding in your Putty session (Connection > SSH > X11). This will show the installer on your Windows PC.
log in on the Linux host in a graphical session, this will automatically set the DISPLAY variable.
Note: I have not installed this but i happened to find a guide with video which may help you.
Please read the section with this heading Install DCEVM to hot redeploy more complicated changes
https://vaadin.com/blog/-/blogs/getting-started-with-vaadin-development-using-eclipse-maven

Can't launch Visual Studio Code on Ubuntu

I'm running a VM in Azure with Ubuntu 14.04. I've installed XFCE and use X2GO to remote desktop to the machine.
I've downloaded the VS Code and unzipped the files. When I run Code from a terminal I get the following error:
WouterDeKort#UbuntuDev:~/tools/web/visual-studio-code$ ./Code
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
WouterDeKort#UbuntuDev:~/tools/web/visual-studio-code$ [ , [Error: channel closed] ]
Any idea what I'm doing wrong?
DISCLAIMER ;-) I'm a total Linux newby. I've just installed Linux for the first time today and I have no idea what I'm doing ;-)
The work-a-round is in issue 3451. After running this, I was able to launch it from Debian Jessie with LXDE over X2Go.
sudo sed -i 's/BIG-REQUESTS/_IG-REQUESTS/' /usr/lib/x86_64-linux-gnu/libxcb.so.1
I have the same problem using X2GO and LXDE. Works okay (but slowly) using MobaXterm so apparently this is a problem specific to X2GO.
For anyone who still wonder what is the best choice if you want to start Visual Studio Code on a headless Ubuntu - the winning combination is:
Ubuntu Server + xfce + nomachine remote desktop
VS Code starts immediately without any hacks, you can set your resolution however you like, and nomachine is blazingly fast.

Encounter "fatal error - NtCreateEvent(lock): 0xC0000077" when execute kinit in cygwin

I have mintty 1.2-beta1(x86_64-pc-cygwin) installed on my Windows 7 64 bit.
Then I installed krb5-workstation version 1.12.1-2 to cygwin using Cygwin Net Release Setup Program.
But when I execute kinit or klist in cygwin, I got an error:
$ kinit
1 [main] kinit 3912 C:\cygwin64\bin\kinit.exe: *** fatal error - NtCreateEvent(lock): 0xC0000077
Hangup
Restarting cygwin or restarting windows didn't work either.
Could anybody help?
I had the same error when starting xterm, which just appears to flash briefly, then exit producing an xterm.exe.stackdump file. If you give xterm the -hold option you will see the NtCreateEvent error. The root cause of my problem was interference from AVG anti virus, and adding c:\cygwin64\bin\xterm.exe to AVG's exception list made xterm work again.
I'm not sure if it helps, but I had the same error code when I was trying to install CPANminus in Cygwin 64-bit. However the installation worked fine in the 32-bit version. It's not a full solution, but maybe you can try the 32-bit version of Cygwin.
I wanted to run gdm3 on my Windows 7 desktop and ran into the same problems as you had. After some fiddeling, I got a working solution that I'm (very) happy with, so I wanted to share this with you. I did the following (you need to do this only once):
Start the Cygwin Terminal (on your Windows PC)
From the terminal, run xlaunch.exe and follow the dialogs (I ended up using XDMCP; a good article about configuring that can be found here)
Safe the resulting config file to your desktop
From now on, you can just click on the dekstop icon to launch the remote (gdm3) desktop.
AVG seems to be causing the exception including a rsync.exe.stackdump.
If you get on the server side:
rsync: safe_read failed to read 1 bytes [Receiver]: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(276) [Receiver=3.1.1]
or client side:
rsync.exe fatal error - NtCreateEvent(lock): 0xC0000058
try disabling AVG. If it works when disabled, I added the rsync.exe as an AVG program exception and rsync is fine again.

Cannot display xclock program on xserver client - Mobaxterm

I am using Mobaxterm(free version) on a windows 7 desktop to connect to a SUSE 11 Enterprise server on AWS. I am trying to display the xclock program on my xtrem client but I get an error saying 'Error: Can't open display:'. I have used the following syntax to set the display on the server:
export DISPLAY=<IP_addr>:0.0
SUSE 11 does not come with xclock by default so I had to download it and install it.
The hosts file on my PC has the localhost entry commented out, I am not sure if that would make a difference. Any ideas on how to debug this? Thanks.
Fixed!
Earlier I was just looking at xclock program's error msg. But when I scanned Mobaxterms client terminal's output, I found the following msg:
X11 forwarding request failed on channel 0
After some google hunting, found that one of the reasons this happens is when xauth package is not installed on the remote server. So, I checked and found that to be the case. This is the command I ran:
zypper in -name xorg*
This command tells you if the package is installed and if any dependencies exist. The package comes bundled with the xclock program. So zypper uninstalled the other xclock I had installed from another source and replaced it with the right version.
Link to package info:
https://www.suse.com/LinuxPackages/packageRouter.jsp?product=server&version=11&service_pack=&architecture=i386&package_name=xorg-x11-xauth
I also modified a file called /etc/ssh/sshd_config as root. The following lines need to be uncommented:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
And X11UseLocalhost was changed to 'no'. I also changed my security group on AWS to let inbound traffic on port 6000. I am not sure if that matters.
After this mobaxterm automatically set my display parameter to localhost and I was able to run xclock on the remote server and see it on my local PC desktop.

Resources