No X11 DISPLAY variable was set, but this program performed an operation which requires it

65,396

If X server is running on the target host and you want the program to display there, you usually perform 'export DISPLAY=:0' where :0 would mean the first X server running. If you are running several X servers (for example Xvnc) on the target host, :0 may become :1 or another number, depending on X server configuration.

If you have X server running locally (the machine you are connecting from) you could use 'ssh -X ...' or 'ssh -Y' to log in to the host and forward your display to the program run remotely. See other answers on redirecting X server over SSH.

Edit: Please check the answer in the linked article.
TL;DR:

  1. Ensure xauth is installed on target
  2. In /etc/sshd_config set X11Forwarding yes
  3. Run ssh with -vv to check what is the problem, if any
Share:
65,396

Related videos on Youtube

mmenon
Author by

mmenon

Updated on September 18, 2022

Comments

  • mmenon
    mmenon over 1 year

    I am trying to install a program on RedHAt7 using ssh / connecting to server. I received the output the following

    Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.greenstone.gatherer.Gatherer.init(Gatherer.java:284)
        at org.greenstone.gatherer.Gatherer.<init>(Gatherer.java:234)
        at org.greenstone.gatherer.GathererProg.main(GathererProg.java:78)
    
    Caused by: java.awt.HeadlessException:
        No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at sun.awt.HeadlessToolkit.getScreenSize(Unknown Source)
        at org.greenstone.gatherer.Configuration.<clinit>(Configuration.java:111)
        ... 3 more
    

    How to fix X11 Display?

  • mmenon
    mmenon almost 7 years
    ubuntu@ubuntu-ThinkCentre-M58p ~ $ ssh -Y root@server ip address... root server ip...'s password: X11 forwarding request failed on channel 0. why happened like this
  • mmenon
    mmenon almost 7 years
    ubuntu@ubuntu-ThinkCentre-M58p ~ $ ssh -X root@server ip address... root server ip...'s password: X11 forwarding request failed on channel 0.
  • mmenon
    mmenon almost 7 years
    both tried X and Y
  • mmenon
    mmenon almost 7 years
    ssh -X -1 not works