If you’re on the main display, then
or if you’re using csh or tcsh
setenv DISPLAY :0.0
before running your app.
Actually, I’m surprised it isn’t set automatically. Are you trying to start this application from a non-graphic terminal? If not, have you modified the default .profile, .login, .bashrc or .cshrc?
Note that setting the DISPLAY to :0.0 pre-supposes that you’re sitting at the main display, as I said, or at least that the main display is logged on to your user id. If it’s not logged on, or it’s a different userid, this will fail.
If you’re coming in from another machine, and you’re at the main display of that machine and it’s running X, then you can use “ssh -X hostname” to connect to that host, and ssh will forward the X display back. ssh will also make sure that the DISPLAY environment variable is set correctly (providing it isn’t being messed with in the various dot files I mentioned above). In a “ssh -X” session, the DISPLAY environment variable will have a value like “localhost:11.0”, which will point to the socket that ssh is tunnelling to your local box.