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

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?

1 Answer

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
4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like