views:

16609

answers:

2

Hello,

I am trying to install a program (a Java application) on my linux machine (I am using Slackware). I have received the following mistake, and I do not understand it. Could you advise me how to approach the problem? I am not sure whether this is a kind of question I could ask here, because it is not exactly a programming question, but I would appreciate if you reply. Thank you.

Here is what I get: (I see that some X11 DISPLAY variable needs to be set, but what value should I give it and how?)

~$ java -jar gate-5.0-beta1-build3048-installer.jar - ERROR -

java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(Graphic sEnvironment.java:159)
at java.awt.Window.<init>(Window.java:407)
at java.awt.Frame.<init>(Frame.java:402)
at net.sourceforge.mlf.metouia.borders.MetouiaDotsBuf fer.<init>(MetouiaDotsBuffer.java:105)
at net.sourceforge.mlf.metouia.borders.MetouiaDots.<i nit>(MetouiaDots.java:66)
at net.sourceforge.mlf.metouia.borders.MetouiaToolBar Border.<init>(MetouiaToolBarBorder.java:49)
at net.sourceforge.mlf.metouia.MetouiaLookAndFeel.ini tComponentDefaults(MetouiaLookAndFeel.java:241)
at javax.swing.plaf.basic.BasicLookAndFeel.getDefault s(BasicLookAndFeel.java:130)
at javax.swing.plaf.metal.MetalLookAndFeel.getDefault s(MetalLookAndFeel.java:1591)
at javax.swing.UIManager.setLookAndFeel(UIManager.jav a:537)
at javax.swing.UIManager.setLookAndFeel(UIManager.jav a:581)
at com.izforge.izpack.installer.GUIInstaller.loadLook AndFeel(GUIInstaller.java:373)
at com.izforge.izpack.installer.GUIInstaller.<init>(G UIInstaller.java:116)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Construc tor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:30
at com.izforge.izpack.installer.Installer.main(Instal ler.java:62)
+7  A: 

If you're on the main display, then

export DISPLAY=:0.0

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.

Paul Tomblin
Hi, thank you very much, the first one worked for me. Yes, I am starting it from a non-graphic terminal.
It sounds like it wants to accesss the graphics display though. Be careful not to run it when the graphics display isn't available, or it belongs to some other userid.
Paul Tomblin
note that this worked because you are/were on the console. if you were on another terminal, you would have to have an X server running on the terminal and then set the environment to point to your machine (export DISPLAY='hostname of pauls terminal':0.0 for example)
KevinDTimm
@kevindtimm, Good point - I'm going to incorporate @Mikeage's info about ssh -X into my answer.
Paul Tomblin
+2  A: 

Are you running this from within an X11 environment? You can use a terminal window, but it has to be within X (either after a graphical login, or by running startx).

If you're already within a graphical environment, try export DISPLAY=:0 for bash like shells (bash, sh, etc) or setenv DISPLAY :0 for C shell based shells (csh, tcsh, etc)

If you've connected from another machine via SSH, you use the -X option to display the graphical interface on the machine you're sitting at (provided there's an X server running there (such as xming for windows, and your standard Linux X server).

Mikeage
Hi, I am running startx.
Oh right, Slackware. Is it still as barebones as it was when I last used it 10 years ago?
Paul Tomblin
It still starts up by default in runlevel 3. Of course, if you tell it to start in runlevel 5, you'll get a pretty KDM login menu assuming you installed KDE.
Adam Jaskiewicz