18 Apr 2014 
Support Center » Knowledgebase » How do I set the DISPLAY variable on Linux
 How do I set the DISPLAY variable on Linux
Solution Using Linux, and especially configuring Linux, normally require some insight, and we strongly suggest (to inexperienced linux users) to get some help from a system administrator.

In short, you must open up a shell (csh, bash, etc), so that it is possible to issue commands on Linux. Then you must enter the commands to set the environment variable, as explained in the setup-instructions.

Also, if you are starting Tomcat (or other application server) automatically by calling the startup-script in the this script:

/etc/rc.local

..then you must make sure that the command for setting the DISPLAY variable is called before starting the application server.

There are many discussions/guides on the Internet regarding this issue. Here is an extract from one:

"1. A Little Theory

The magic word is DISPLAY. In the X window system, a display consists
(simplified) of a keyboard, a mouse and a screen. A display is managed
by a server program, known as an X server. The server serves
displaying capabilities to other programs that connect to it.

A display is indicated with a name, for instance:
* DISPLAY=light.uni.verse:0
* DISPLAY=localhost:4
* DISPLAY=:0

The display consists of a hostname (such as light.uni.verse and
localhost), a colon (:), and a sequence number (such as 0 and 4). The
hostname of the display is the name of the computer where the X server
runs. An omitted hostname means the local host. The sequence number is
usually 0 -- it can be varied if there are multiple displays connected
to one computer.

If you ever come across a display indication with an extra .n attached
to it, that's the screen number. A display can actually have multiple
screens. Usually there's only one screen though, with number n=0.

Other forms of DISPLAY exist, but this will do for our purposes.

2. Telling the Client

The client program (for instance, your graphics application) knows
which display to connect to by inspecting the DISPLAY environment
variable. This setting can be overridden, though, by giving the client
the command line argument -display hostname:0 when it's started. Some
examples may clarify things.

Our computer is known to the outside as light, and we're in domain
uni.verse. If we're running a normal X server, the display is known as
light.uni.verse:0. We want to run the drawing program xfig on a remote
computer, called dark.matt.er, and display its output here on light.

If you have csh running on the remote computer:

dark% setenv DISPLAY light.uni.verse:0
dark% xfig &

Or alternatively:

dark% xfig -display light.uni.verse:0 &

If you have sh running on the remote computer:

dark$ DISPLAY=light.uni.verse:0
dark$ export DISPLAY
dark$ xfig &

Or alternatively:

dark$ DISPLAY=light.uni.verse:0 xfig &

Or, of course, also:

dark$ xfig -display light.uni.verse:0 &


It seems that some versions of telnet automatically transport the
DISPLAY variable to the remote host. If you have one of those, you're
lucky, and it's automatic. If not, most versions of telnet _do_
transport the TERM environment variable; with some judicious hacking
it is possible to piggyback the DISPLAY variable on to the TERM
variable."


Article Details
Article ID: 17
Created On: 21 Nov 2004 02:03 PM

 This answer was helpful  This answer was not helpful

 Login [Lost Password] 
Email:
Password:
Remember Me:
 
 Search
 Article Options
Home | Submit a Ticket | Knowledgebase
Language:

Help Desk Software By Kayako SupportSuite v3.10.02